We help IT Professionals succeed at work.
Get Started

Ajax not completing

Ralph asked
Last Modified: 2016-08-04
This used to work, I lost some code, thank you Windows, and now it doesn't.

The PHP does its thing and returns, but nothing happens on the return to JavaScript.  No "HERE THREE!"!

The JS AJAX code:
var php_params = "job=SearchForm&task=PartialForm&tablename=Customer&uniq_field_value="+cust_name ; 
      var fields_to_BU = ['cust_name', 'cust_desig_2char', 'cust_desig_3char', 'region'] ;
      var customer_id ;
      $('#debug').html(php_params) ;
      url: '/cmdb/PHP/do_FormSearch_query.php',
      method:     "GET" ,
      cache:      false ,
      data:       encodeURIComponent(php_params)  ,
      dataType:   'JSON'
        alert("HERE THREE!");
        customer_id = data.customer_id ;
        $('input [name=cust_desig_2char]').val(data.cust_desig_2char) ;
        $('input [name=cust_desig_3char]').val(data.cust_desig_3char) ;
        $('input [name=region]').val(data.region) ;
        $('#RtMgn_Customer').val(customer_id) ;
         blah blah blah;
      })  ;  // EO AJAX .done function()

Open in new window

The PHP:
case "PartialForm":
        $uniq_field_value = htmlspecialchars($_GET['uniq_field_value']) ; 
        $tablename = htmlspecialchars($_GET['tablename']) ;
        case 'Customer':
          do_mysql_multi("SELECT * FROM Customer WHERE `cust_name`= '".$uniq_field_value."' ;", 1, $result_vector1, $result_vector2) ;
          echo json_encode($result_vector1['values'][1]) ;
          break ;

Open in new window

What PHP returns (sample):
{"customer_id":"76","cust_name":"QATAR AIRWAYS","cust_desig_2char":"QR","cust_desig_3char":"QTR","region":"Middle East","note_id":"75750"}

Open in new window

Watch Question
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE