user39653 user39653 - 1 year ago 135
jQuery Question

Updating a jQuery-UI Dialog

I have a jQuery-UI Dialog that contains a select list that can get updated by another process. I need to know how to force the Dialog to use the updated select list. I update the select list via $.getJSON() but I don't know how to get the Dialog to use the updated select. I've tried dialog("destroy") on close/cancel but I don't know how to bring it back again after I've done that.

Here's the code I use to update the select element. I believe it's updating the element correctly but the dialog doesn't see the change the next time I open the dialog.

$.getJSON('AJAX/GetGroups.php', function(j){
var options = '';
for( var i = 0; i < j.length; i++ )
options += '<option value="' + j[i].value + '">' + j[i].text + '</option>';


Answer Source

You don't need to destroy the need to update the select list. You should have some identifier or class on the select list which you can modify using jQuery. Please post some relevant HTML to get a more detailed solution.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download