[RESOLVED]Passing Parameters to JQuery Dialog Box

Hello everyone and thanks for your help in advance.  I am new to JQuery and need to create links that will open a JQuery dialog box, but will also pass parameters from the link to the opening function in order to make a WebAPI call.  The links will be within
some type of table, although unlikely to be a .Net data control.  Any help would be appreciated.

Hi kmcnet,

For your issue ,I suggest that you can use .data method to pass parameter for your dialog.

please refer to the code snippet below:

$('#link').bind('click', function(e) {
    $("#dialog-confirm")
        .data('parameter name', "parameter value")  // store the parameter for dialog
.dialog('open'); });

Here is your dialog:

$('#link').dialog({
 ...options...
 buttons: {
 "OK": function () {
//get the parameter value var val = $(this).data('parameter name'); } }

Best Regards,

Kevin Shen.

Leave a Reply