Sending array to jQuery UI Dialog
I am creating an ASP.NET MVC application with zip search functionality. I am capturing the zip code from the user submitting it to the web service and returning an array of addresses. I would like to display an array of addresses in something like a jQuery UI dialog. The user can then select the correct address to be returned and fills in the address fields. Is this possible through dialogue?
a source to share
You will need to format the array as a JSON object and then, for example, read it using $ .getJSON. Easy to populate combo box with array content.
You can have a combo box inside a UI dialog box - this is the same as having the combo box always visible. In fact, the dialog is only part of the displayed and hidden DOM. It is no different from other DOM elements.
a source to share
You can use jQuery to insert HTML and then open a dialog like:
function displayAddressList() {
var url = '<%= Url.Action("List", "Address") %>';
$.get(url, function(data) {
$("#PopUp").html(data);
$("#PopUp").dialog('open');
});
}
HTML:
<div id="PopUp" title="Address List"></div>
So, if your message handler code in your controller returns a View (control), you can type it in and then open a dialog.
a source to share
Instead, you can use textbox control as described in "jQuery Auto-Complete Text Box with ASP.NET MVC" by Ben Sheirman.
a source to share