我有編碼爲這樣的按鈕:ASP.NET:如何提交,回傳後,才客戶端AJAX完成
<asp:Button ID="save_all_filt" runat="server" Text="All data for filtered subjects"
ClientIDMode="Static" OnClientClick="a= saveAllFilt(); return a; "
OnClick="save_all_filt_Click" />
saveAllFilt是調用常用的JQuery Ajax調用的函數。事情是這樣的:
function saveAllFilt() {
jQuery.ajax({
async: false,
dataType: 'json',
contentType: "application/json; charset=utf-8",
type: "POST",
url: contentURL,
data: dataarray,
success: function (msg) {
// Some processing here. ONLY WHEN IT IS DONE, I NEED TO HAVE POSTBACK.
},
error: function (data) {
}
}); // end of ajax call.
}
我想這樣一件事:在的onClick應該僅進行後Ajax調用完成。我該怎麼做?
請你能解釋這是如何解決他的問題? – Gar
只需在javascript中搜索_postback函數的Google語法。只需在jQuery ajax函數的成功塊中調用這個_postback函數即可。 – chandan