update.php页面
window.onbeforeunload
想在function myfoo(){
$.ajax({
url: "update.php",
dataType: 'json',
data: {id: 1},
success: function (r) {}
});
}
window.onbeforeunload = function(){
myfoo();
return 'Are you sure you want to leave?';
};
上的index.php页面上使用update.php文件
在这里使用ajax
Cursor cursor = db.rawQuery("SELECT * FROM videoplayer where " + KEY_VIDEO_TAG + " like '%"+ searchText +"%'", null);
答案 0 :(得分:1)
1)您没有发送任何数据,例如行包
2)ajax未定义类型:'post',但您的访问价值是邮寄。如果你没有定义类型意味着ajax将使用默认的get方法。
$.ajax({
url: "update.php",
type:'post',
dataType: 'json',
data: {id: 1,bags:bags}, // bags collection value what your goging to send to server
success: function (r) {}
});
答案 1 :(得分:0)
工作代码只需改变一件事。谢谢@JYoThI https://stackoverflow.com/users/5933698/jyothi
$.ajax({
url: "update.php",
type:'post',
dataType: 'json',
data: {
on_timeout: 1 // i just add this line
},
// bags collection value what your goging to send to server
success: function (r) {}
});