Open Dialogue And Populate DropDown Within
I have the following div on my page.
- <div id="edit">
<select id ="pages" ></select>
</div>
I want to populate the above dropdownlist with json data but it is not working . Below is my code.
- $(document).ready(function () {
- var data = "[{'url1':'page1','url2':'page2','url3':'page3'}]";
- $('#edit').dialog({ autoOpen: false })
- $('#editpage').click(function () {
- $('#edit').dialog('open');
- $.each(jQuery.parseJSON(data), function (i, value) {
- $('#pages').select.append('<option value="' + value.url + '">' + value.url + '</option>');
- });
- });
- })