📜  javascript kill ajax 请求 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:46.703000             🧑  作者: Mango

代码示例1
//This kill only the request
//If the server handled the request, the .abort() function won't kill it
var xhr = $.ajax({
    type: "POST",
    url: "some.php",
    data: "name=John&location=Boston",
    success: function(msg){
       alert( "Data Saved: " + msg );
    }
});

//kill the request
xhr.abort()