我试图使用使用Chrome控制台下面发送一个Ajax请求到服务器:JQuery Ajax语法错误?
$.ajax({
url: 'http://www.adidas.co.uk/on/demandware.store/Sites-adidas-GB-Site/en_GB/Cart-MiniAddProduct',
data: {
"request": "ajax",
"Quantity": "1",
"g-recaptcha-response": "redacted",
"responseformat": "json",
"sku": "AQ5934",
"pid": "AQ5934_660"
},
method: 'POST',
crossDomain: true,
contentType: 'application/x-www-form-urlencoded',
xhrFields: {
withCredentials: true
},
complete: function(data, status, xhr) {
console.log(status);
console.log(data);
}
});
然而,我发现了以下错误:
Uncaught TypeError: $.ajax is not a function
at <anonymous>:1:3
我导致相信这个问题是由于语法错误,我找不到在下面的方法中的语法错误,有人可以帮我找到它吗?
你是如何加载jQuery脚本? – winseybash
不应该因为我使用的是Chrome控制台 –
jQuery是否在您使用控制台检查的页面上加载? – winseybash