2016-09-16 2 views
0

jquery ajax를 사용하여 입력 값을 PHP로 보내주는이 HTML 양식이 있습니다. 프로세스는 잘 진행되었지만, 필자가 마우스 오른쪽 버튼을 클릭하고 요소> 네트워크> 헤더를 검사 할 때만 볼 수 있습니다. 불행히도 실제 페이지는 그대로 유지됩니다.HTML jQuery Ajax에서 PHP로 값을 전송하는 양식

어쨌든 내가 잘못 했습니까? 도와주세요. 정말 고마워. 정말 고마워.

  • 내가 분명히 프로세스가 잘 갔다와 올바른 결과를 보여 주었다 때문에 내가, JQuery와 아약스에 엉망 것 같아요 원인 난, 전체 코드를 포함 didnt는

HTML 양식

<div class="product-filter-type"> 
        <input type="radio" class="checkFilter" id="filterAllTV" name="typeTV" value="AllTV" checked><label class="filterType" for="filterAllTV">All TV</label><br/> 
        <input type="radio" class="checkFilter" id="filterFHDTV" name="typeTV" value="FHD"><label class="filterType" for="filterFHDTV">FHD/HD</label><br/> 
        <input type="radio" class="checkFilter" id="filter4K" name="typeTV" value="FOURK"><label class="filterType" for="filter4K">4K</label> 
       </div> 

JAVASCRIPT/JQUERY/AJAX

,210

PHP (FUELPHP는)

public function action_product() { 

    $this->set_meta_info($this->_meta_slug); 

    $input_data = \Input::param(); 

    if(count($input_data) > 0){ 

     $this->_filter($input_data); 

    }else{ 

     $this->_data_template['product'] = \Product\Productutil::get_product_data(); 
     $this->_data_template['AllTV'] = 'checked'; 

    } 

    return \Response::forge(\View::forge('pages::frontend/product_list.twig', $this->_data_template, FALSE)); 
} 

private function _filter($input_data) { 

    $this->set_meta_info($this->_meta_slug); 

    if (count($input_data) > 0) { 

     $type  = isset($input_data['type']) ? $input_data['type'] : null; 


     if ($type){ 

      $this->_data_template['product'] = \Pages\Filterutil::get_type_product($type); 
      $this->_data_template[$type] = 'checked'; 

     }elseif { ... } 

     return $this->_data_template; 
    } 

} 
+2

예상되는 결과는 무엇입니까? 모든 코드는 AJAX 요청을 보내고 콜백에서 아무 것도하지 않으므로 UI의 아무 것도 변경되지 않습니다. –

+0

질문하기 –

+0

dev 도구에서 xhr 요청을보아야합니다. 주 페이지의 헤더가 변경되지 않습니다. – madalinivascu

답변

0

좋아, 나는 그것을 얻었다.

나는

success: function (response) { 

      var json = $.parseJSON(response); 

      for (idx= 0; idx< json.length; idx++) { 

       .... 

      } 
     } 
    }); 

는 그것을 감사, 여러분 모두 감사의 PHP 부분에
$this->_filter($input_data); 
     return json_encode($this->_data_template['product']); 

를 추가하고 추가했습니다. 이 질문을 닫는 방법?

관련 문제