我不是ajax / jQuery的菜鸟,但这让我摸不着头脑:
$('a').click(function () {
console.log('click registered');
var data = ""; // I have tried this with and without data.
$.ajax({
type: "POST",
url: "http://localhost/Analytics/LinkClicked",
data: data,
success: function () {
console.log("MADE IT");
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log("OK, I see an error");
console.log('--- ' + errorThrown + ' --- ' + textStatus + ' ---');
}
});
});
我的控制台看起来像这样:
> click registered
> POST http://localhost/Analytics/LinkClicked (In Red)
> OK, I see an error
> --- --- 0 ---
当我打开post元素(firebug)时,它也没有相关数据。我也抛弃了XMLHttpRequest对象,但它也没有给我任何线索。
为什么我没有收到错误消息?