Mithun Sreedharan
Mithun Sreedharan

Reputation: 51272

jQuery UI dialog and Ajax POST, JSON

Is it possible to combine Ajax post with jQuery UI dialog? And I want to process the ajax reponse in JSON to HTML for showing inside the Dialog box

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
        }
    }
});

Upvotes: 2

Views: 7436

Answers (1)

Sam
Sam

Reputation: 4487

You can change it to POST by providing data as an object.

For example:

$("#dialog-modal").load(url, {"requestId": requestId, "userId": userId})

Upvotes: 8

Related Questions