2
我想通过JQuery发送一个AJAX请求。AJAX JQuery请求不起作用
这里是我的jQuery代码:
$(document).ready(function() {
$("#login").submit(loginh);
function loginh() {
console.log("Sending request");
var dat = {
"ucCustomer": {
"ucLoginRequest": {
"customerId": "8a6a7d82392bdaa701392bdabb3a0013",
"userName": "[email protected]",
"password": "23456"
}
}
};
console.log(JSON.stringify(dat));
var d = JSON.stringify(dat);
$.ajax({
headers: {
"Content-Type": "application/json",
"X-Message-Sending-PartnerId": "UNICREDIT",
"X-Message-Type": "ucCustomerLoginRequest",
"X-App-UserId": "UNICREDIT",
"X-App-DeviceFingerPrint": "abc"
},
type: "POST",
url: "http://localhost:8010/UniCreditMobileService/services/ucms/customer",
data: d,
success: function(data) {
alert(data);
console.log("success: " + data);
}
});
}
});
我已经用Java编写的JUnit测试案例和申请工作正常。同样,我已经尝试使用Chrome浏览器的Dev-HTTP插件发送请求,并且它工作正常。但是,我的JQuery代码不起作用。
当我启动html页面时没有任何反应。我没有回应。我正在使用Firebug控制台来检查从服务器收到的响应。
请帮我解决这个问题。
工作就像一个魅力!哇。这是做什么的? – CuriousCoder 2012-08-16 18:29:08
@hari不客气,伙计 – thecodeparadox 2012-08-16 18:29:26