ajax调用没有响应

问题描述:

ajax调用创建问题。它在浏览器中工作正常,但通过ajax它不会被调用。 URL在这里http://testbed2.baileyprofile.com/dd-api.php?test=1ajax调用没有响应

当我检查它在Firefox检查元素控制台。它发送请求并在大约900毫秒或mroe然后它给消息200 Ok和URL颜色变成红色。它根本没有产生任何反应。

请任何提示它可能有什么问题。 我的代码下

jQuery.post(ajaxurl, {action: 'test' }, function(response) { 
     if (response!= '') { 
      jQuery('#test-result').html("Restule is generated successfully, copy of result has been sent to your inbox").fadeOut(10000); 
      document.getElementById("txtFeedback").value= response; 
      //console.log(response.data); 
      //alert('POST title: ' + response.data.post_title); 
     } else { 
      // something didn't go well 
      console.log(response.status); 
     } 
    }); 
+0

如何响应看起来像? – gdoron

+0

实际上,在检查模式下,网址变为红色,并且没有给出任何回应。它有任何回应将是简单的文字。 – nbhatti2001

+0

一个人想通知你,这个请求正在其他服务器上。意思是我有a.com并向b.com发送请求。它应该会有什么问题吗? – nbhatti2001

更新:

我有a.com和发送请求到b.com。它应该会有什么问题吗?

你违反了Same origin policy,你不能从域a.com的阿贾克斯b.com

+0

我使用此代码显示消息“错误”“代码” var jqxhr = jQuery.ajax({type:“GET”,url:“http://212.124.100.44/gmemo/dd-api.php",data:{'test':'1'}}) .done (function(){alert(“success”);}) .fail(function(jqXHR,textStatus){alert(“error”+ textStatus);}) – nbhatti2001

+0

所以我该如何解决这个问题。我需要发送请求到其他服务器,并需要它的数据。 – nbhatti2001

+0

@ nbhatti2001。那么'

数据参数应在“”。尝试它,它应该工作

jQuery.post(ajaxurl, {'action': 'test' }, function(response) { 
     if (response!= '') { 
      jQuery('#test-result').html("Restule is generated successfully, copy of result has been sent to your inbox").fadeOut(10000); 
      document.getElementById("txtFeedback").value= response; 
      //console.log(response.data); 
      //alert('POST title: ' + response.data.post_title); 
     } else { 
      // something didn't go well 
      console.log(response.status); 
     } 
    });