ajax 同步
$.ajax({
url:'login?address=logincheck',
dataType:'json',
async:false,//同步爲false,異步爲默認(true)
data:{
username:uname,
password:upass
},
success:function(data){
}
跳轉後後臺正常執行,而回調函數沒有值時:將ajax傳值改爲同步即可
其中 getJSON post get 方法默認爲異步
ajax 同步
$.ajax({
url:'login?address=logincheck',
dataType:'json',
async:false,//同步爲false,異步爲默認(true)
data:{
username:uname,
password:upass
},
success:function(data){
}
跳轉後後臺正常執行,而回調函數沒有值時:將ajax傳值改爲同步即可
其中 getJSON post get 方法默認爲異步
https://stackoverflow.com/questions/419163/what-does-if-name-main-do