ajax调用创建问题。它在浏览器中工作正常,但通过ajax它不会被调用。网址在http://testbed2.baileyprofile.com/dd-api.php?test=1
当我在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 :(得分:1)
答案 1 :(得分:0)
数据参数应在''内。尝试它,它应该工作
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);
}
});