jQuery UI对话框和Ajax POST,JSON

Mit*_*ran 2 ajax jquery json dialog jquery-ui

是否可以将Ajax post与jQuery UI对话结合起来?我想将JSON中的ajax响应处理为HTML,以便在对话框中显示

var url = AJAX_URL+requestId+'/'+userId;
// Need to POST the requestId and userId instead of GET

$("body").append("<div id='dialog-modal'>Loading...</div>");
$("#dialog-modal").dialog("destroy");
$("#dialog-modal").load(url).dialog({
    modal:   true,
    title:   "Update Status",
    buttons: {
        Cancel: function() {
            $(this).dialog('close');
        },
        Update: function() {
            // Do something
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

Sam*_*Sam 8

您可以通过提供数据作为对象将其更改为POST.

例如:

$("#dialog-modal").load(url, {"requestId": requestId, "userId": userId})
Run Code Online (Sandbox Code Playgroud)