Pass a variable to JQuery UI dialog

前端 未结 4 796
甜味超标
甜味超标 2020-12-09 08:12

I am deleting a record using PHP. I want to use a JQuery UI dialog to confirm the action, but I dont know how to pass a variable (my RecordID) to the redirect URL function,

4条回答
  •  误落风尘
    2020-12-09 09:07

    You can try using the .data() method to store data for you. Take a look at this answer Passing data to a jQuery UI Dialog

    For example to pass a variable, you can store it using the data function, before opening the dialog

    $("#dialog_div")
    .data('param_1', 'whateverdata')
    .dialog("open");
    

    Then you can get this back by:

    var my_data = $("#dialog_div").data('param_1')
    

提交回复
热议问题