はあなたの関数にe.preventDefault()
を追加します。
$(document).ready(function() {
xhr = $.ajax({
url: "www.something.com",
type: "GET",
cache: true,
success: function (response) {
alert("successful");
},
error: function (e) {
alert("Oops Something went wrong");
}
});
});
$("#stickertab").click(function (e) {
appUrl = "www.nothing.com";
$("#show_Sticker").empty();
if (xhr != null) xhr.abort();
xhr = $.ajax({
url: appUrl,
type: "GET",
cache: true,
success: function (response) {
alert("successful");
},
error: function (e) {
alert(" Oops Something went wrong");
}
});
});
これは私が取得していますエラーは次のとおりです。ここに私のサンプルコードです。
$("#stickertab").click(function (e) {
e.preventDefault(); // <-- here
appUrl = "www.nothing.com";
$("#show_Sticker").empty();
if (xhr != null) xhr.abort();
xhr = $.ajax({
url: appUrl,
type: "GET",
cache: true,
success: function (response) {
alert("successful");
},
error: function (e) {
alert(" Oops Something went wrong");
}
});
});
エラーは何ですか? –
エラー詳細 –