只有事件卸载页面调用函数ajax这个模具
$( window ).on('unload',function(e) {
e.preventDefault();
ajax_delete_support_models(12);
});
-ajax run
function ajax_delete_support_models(sm_id){
var token = getTokenFromBrown();
var data_submit = {'csrfmiddlewaretoken':token,'sm_id':sm_id}
var ajax_data = $.ajax({
type: "POST",
url: 'http://localhost/delete-support-models/',
data :data_submit,
async : false,
error: function (request, status, error) {
console.log(request);
},
success: function(data){
console.log('ok success')
}
});
}
- 调试此
代码:19
消息:“发生网络错误。”
name:“NetworkError”
答案 0 :(得分:2)