When jquery is running this is not going "success" this is going in "error" section.My php file is on another server.code is like below.
  $(document).ready(function() {  
    //if submit button is clicked  
    $('#recaptcha_reload').click(function () { 
   var data ="publick="+document.getElementById("publickeyval").value+"&privatek="+document.getElementById("privatekeyval").value;
 alert(data);
//start the ajax  
      $.ajax({
           //this is the php file that processes the data and send mail  
           url: "http://www.example.com/example_api/example_adcpatchaapi.php",   
           //GET method is used  
           type: "GET",  
           //pass the data           
           data: data,       
           //Do not cache the page  
           cache: false,  
           //success  
           success: function (html) { 
alert(html);
               if (html) {      
document.getElementById('captcha_table').innerHTML=html;    
               }    else{
      alert("####");  // runing this alert box
 }
           },
    error : function(XMLHttpRequest, textStatus, errorThrown) {
            alert(XMLHttpRequest.status); // showing 0 
        }      
       });  
       //cancel the submit button default behaviours  
       return false;  
   });   
});
 
     
     
    