【发布时间】:2015-08-06 10:16:23
【问题描述】:
我在这里有 WordPress 的测试代码。
jQuery(document).ready(function($) {
var link = 'http://000.00.00.00/cgi-bin/test.cgi';
$("#sub").click(function() {
$.ajax({
type:'POST',
url: link,
crossDomain: true,
crossOrigin: true,
headers: {
'Accept': 'application/json',
'Content-Type': 'text/html'
},
dataType: "json",
success: function(data) {
console.log(JSON.stringify(data));
},
error: function(e) {
console.log("Error: " + e);
},
});
});
请求似乎很好,因为当我查看我的 chrome 网络时 > 标题选项卡状态代码正常,但问题是没有数据。我应该有这样的工作输出..
{ "loyalty" : { "status" : { "rows" : "1", "sql" : "success", "result" : "ok" }, "data" : [ { "card_number" : "1410104000350018" , "card_type" : "BEAUTY ADDICT" , "first_name" : "TINA" , "middle_initial" : "M" , "last_name" : "LIM" } ] } }
【问题讨论】:
标签: javascript jquery ajax wordpress cross-domain