2011-07-31 5 views
0

내 코드가이 오류가있는 이유는 버튼 제출을 클릭하고 링크 검색을 클릭 한 후입니다.
codeigniter를 사용합니다.jQuery-ajax 디버그 내 코드 내 코드 !?

An error has occured: 
[object Object] 
error 

이 내 Tour_foreign-> CI_Controller :

function search_customer(){ 
    $customer_number = $this->input->post('customer_number'); 
    $query = $this->db->get_where('customer', array('customer_number' => $customer_number)); 
    if($query->num_rows()==0){ 
       echo '0'; 
      }else{ 
       $data = array(); 
       foreach ($query->result() as $row) 
       { 
        $data[] = $row; 
       } 
       echo json_encode($data); 
      } 
    } 

function insert_customers(){ 
    $customer_number = ""; 
    for($i = 0; $i < 10; $i++) 
    $customer_number .= mt_rand(0, 9); 
    /*////////////////////////////////////*/ 
    $jdate = jgmdate("j F Y"); 
     /*////////////////////////////////////*/ 
     $useradmin = $this->session->userdata('login'); 
     $query = $this->db->get_where('login', array('useradmin' => $useradmin))->row(); 
     $nameadmin = $query->nameadmin; 
     $lastnameadmin = $query->lastnameadmin; 
     /*////////////////////////////////////*/ 
    $data = array (
       'customer_number' => $customer_number, 
     'name' => $this->input->post('name'), 
     'name_en' => $this->input->post('name_en'), 
     'father_name' => $this->input->post('father_name'), 
     'number_birth_certificate' => $this->input->post('number_birth_certificate'), 
     'national_number' => $this->input->post('national_number'), 
     'passport_number' => $this->input->post('passport_number'), 
     'term_passport' => $this->input->post('term_passport'), 
     'date_of_birth' => $this->input->post('date_of_birth') , 
       'phone' => $this->input->post('phone'), 
     'mobile' => $this->input->post('mobile'), 
       'address' => $this->input->post('address'), 
       'nationality' => $this->input->post('nationality'), 
     'accommodation' => $this->input->post('accommodation'), 
     'education' => $this->input->post('education'), 
     'zip_code' => $this->input->post('zip_code'), 
     'marital_status' => $this->input->post('marital_status'), 
     'bank_name' => $this->input->post('bank_name'), 
       'branch_name' => $this->input->post('branch_name'), 
     'card_number' => $this->input->post('card_number'), 
     'account_number' => $this->input->post('account_number'), 
     'zip_code' => $this->input->post('zip_code'), 
     'job' => $this->input->post('job'), 
       'date_submit' => $jdate, 
     'useradmin_submit' => $nameadmin.'&nbsp;'.$lastnameadmin , 
    ); 
    //if(!empty($data)){ 
     $this->db->insert('customer', $data); 
     //} 
    } 
+0

파이어 버그에서 코드를 디버깅하려 했습니까? 500 내부 서버 오류가 발생하는 것을 볼 수 있습니다. – Dave

+0

그래, 난 방화 광 및 chorme 콘솔에서했지만 결과는 –

+0

아니지만 내가 말한 동일한 오류를 참조하십시오 –

답변

0

나는 내가 불을 지르고 콘솔에서 다음과 같은 오류보고이 스크립트를 사용하려고 : NetworkError를 500 내부 서버 오류를

이것이 오류가 나타나는 이유입니다. 서버 부분을 수정하십시오. search_customer() 함수 내의 모든 코드를 지우고 실행되는지 확인하십시오. 이 메소드가 실행되지 않으면 문제는 프레임 워크에서 벗어난 것입니까?

그런 다음 줄 단위로 서버에서 어떤 일이 발생하는지 확인하십시오. 그것은 쿼리에 문제가 될 수 있습니까? 하지만 일반적으로 오류 500은 mod_rewrite에 문제가있을 때입니다.

+0

하지만 서버에 tour_foreign.php 파일이 있습니다. 왜이 링크에 오류 500 (내부 서버 오류가 있습니까? localhost에서이 오류가 아니며 상단 게시물에서 말한 오류가 있습니다) –

+0

죽을 삽입하려고 시도합니다 ("this is test"). search_customer()의 첫 번째 줄은 문제가 어디에 있는지 알 수 있습니다. 문제가 search_customer 함수에 의해 처리되었는지 또는 외부에서 생각하는지 알 수 있습니다. –