troubleshooting Question

Ajax not completing

Avatar of Ralph
RalphFlag for United States of America asked on
AJAX
11 Comments1 Solution181 ViewsLast Modified:
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) ;
      
      $.ajax({
      url: '/cmdb/PHP/do_FormSearch_query.php',
      method:     "GET" ,
      cache:      false ,
      data:       encodeURIComponent(php_params)  ,
      dataType:   'JSON'
      }).done(function(data) 
      {
        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()


The PHP:
case "PartialForm":
        
        $uniq_field_value = htmlspecialchars($_GET['uniq_field_value']) ; 
        $tablename = htmlspecialchars($_GET['tablename']) ;
        
        switch($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 ;
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"}
ASKER CERTIFIED SOLUTION
Member_2_248744

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros