开发者

jquery error sending message

开发者 https://www.devze.com 2023-01-16 14:15 出处:网络
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.

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;  
   });   

});


Sorry to say, same origin policy applies, you cant access pages outside the current domain/server using AJAX


Use JSONP for cross-site callbacks.

Some useful links:

  • http://api.jquery.com/jQuery.getJSON/
  • http://www.ibm.com/developerworks/library/wa-aj-jsonp1/
0

精彩评论

暂无评论...
验证码 换一张
取 消