我有一個控制器兩種方法:Page
Load
和。 Page
回報view
但Load
回報JsonResult
。我也有一個與我打電話給我的方法jquery-functions
的看法。調用控制器方法與jquery異步
他們在執行訂單,但我希望異步調用它們。我怎麼做?
function **LoadPage**(page, isnext) {
$(':focus').blur();
$('#loadingBlockElement').show();
$.ajax({
type: "GET",
url: '@Html.Raw(Url.Action("page", new { formId = Model.Params.FormId, userId = Model.Params.UserId, baseVersion = Model.Params.BaseVersion, stateName = Model.Params.StateName, stateVersion = Model.Params.StateVersion, stateFormId = Model.Params.StateFormId, baseFormId = Model.Params.BaseFormId }))'+'&page='+page+'&isnext='+isnext,
success: function (result) {
$('body').find('.ui-dialog').find('div').remove();
$('body').find('.ui-dialog').remove();
WE = null;
$('#main').html(result);
$('form').hide();
}
});
}
function **Load**() {
$.ajax({
type: "POST",
url: "@Url.Action("load")"+'[email protected]'+'&[email protected]'+'&[email protected]'+'&[email protected]'+'&[email protected]'+'&[email protected]'+'&[email protected]'+'&page='+$('form:first').attr('ID'),
success: function (result) {..bla-bla-bla
控制器:
負載:
public JsonResult Load(int formId, int baseVersion, string stateName, int stateVersion, string page, string userId, int stateFormId, int baseFormId)
{
...
}
頁:
public ActionResult Page(int formId, int baseVersion, string stateName, int stateVersion, string page, string userId, bool? isNext, int stateFormId, int baseFormId)
{
...
}
究竟什麼是你的問題? –
如果我正確理解你的問題,這是你需要什麼http://api.jquery.com/jQuery.when/ –
我需要調用我的方法異步。他們應該並行執行。 –