求解答!!關(guān)于load()方法異步請(qǐng)求數(shù)據(jù)后,彈出窗口提示
想點(diǎn)擊按鈕后,繼加載完內(nèi)容之后,彈出窗口。但寫(xiě)在回調(diào)函數(shù)之后 。點(diǎn)擊按鈕卻是先彈出窗口 ,再加載數(shù)據(jù)。 哪出了問(wèn)題??
????????$(function(){ ??????????$("#btnShow").bind("click"?,?function(){ ??????????????$("ul") ??????????????.html("<img?src='Images/Loading.gif'?alt=''/>") ??????????????.load("http://idcbgp.cn/data/fruit_part.html",function()?{ ????????????????????????$(this).attr("disabled",?"true"); ????????????????????????alert("執(zhí)行結(jié)束") ??????????????}) ?????????????? ??????????})?? ????????})
2017-08-05
是先加載完再?gòu)棾觥畧?zhí)行結(jié)束'。只是照片顯示的慢,你把<img>圖片換成文字或者另一個(gè)alert('我先彈'),就知道是哪個(gè)先執(zhí)行了: ? .html(alert('我先彈哦'))