1
我被困在一個地方。 我想要做的是我的2個功能,他們兩個都異步運行。所以我發現了jQuery的完成時間,並認爲使用它。jquery當不能正常工作
請參閱以下我的代碼,我使用: -
$.when(doOne(42, PersonId))
.done(function (strDisplayMessage) {
doTwo()
})
function doOne(systemMessageId, personId) {
/* This function is used to make an AJAX call to the backend function to get all the customized system message. */
$.ajax(
{
url: "/Communications/GetSpecifiedSystemMessageAndCustomizeIt",
type: "POST",
data: { intSystemMessageId: systemMessageId, guidPersonId: personId },
dataType: "text",
success: function (data) {
return data;
},
error: function (error) {
return "Error!";
}
});
}
function doTwo(){
...//do something
}
但他們還是異步運行。 任何人都可以幫助我嗎?
感謝名單