How do I trap an http 500 error

How do I trap an http 500 error

Hello,

Im calling a java  program that will make an ajax call using ssl communications to paypal. After the program completes normally Im getting a http 500 error.

The program is completing normally, and even returning the response from paypal. But when the program terminates the browser is telling me Im getting an http 500 server error.

The below variable $ipal is returning a response.

Is there a a way in my ajax call to trap the error Im getting?

  1. $.ajax({                                                                                                                
  2. type: 'get',                                                                                                            
  3. async: false,                                                                                                           
  4. dataType: 'jsonp',                                                                                                      
  5. url:'IPAL03A.PGM',                                                                                                      
  6. data:{port:"TST", SCCUST:$cust, totpra:totprice.toString(), tottxa:tottax.toString(), totsha:totship.toString()},       
  7. success: function($ipal){                                                                                               
  8.  $("#waitmsg").hide();                                                                                                  
  9.  $("#ipal").empty();                                                                                                    
  10.  $("#ipal").append($ipal);                                                                                              
  11.  $("#ipal").dialog({                                                                                                    
  12.    modal: true,                                                                                                         
  13.    height: 650,                                                                                                         
  14.    width: 650,                                                                                                          
  15.    buttons: {                                                                                                           
  16.        Close: function() {                                                                                              
  17.         $( this ).dialog( "close" );                                                                                    
  18.        }                                                                                                                
  19.       }                                                                                                                 
  20.  });