ajax - jquery autocomplete remote json -
i following sample here:
http://demos.jquerymobile.com/1.4.0/listview-autocomplete-remote/#&ui-state=dialog&ui-state=dialog
i want know how adjust section below:
.then(function (response) { $.each(response, function (i, val) { html += "<li>" + val + "</li>"; }); $ul.html(html); $ul.listview("refresh"); $ul.trigger("updatelayout"); });
my json response in following format:
{"directory": [ { "firstname":"john", "lastname":"doe", "email":"user@domain.com", "ext":"1234", "dept":"acme inc." } ]}
how access json data in .then function?
cheers, david
var response ={"directory": [ { "firstname":"john", "lastname":"doe", "email":"user@domain.com", "ext":"1234", "dept":"acme inc." } ] }; $.each(response.directory, function (i, val) { $.each(val, function (index, data) { var html = html+ "<li>" + data+ "</li>"; alert(data); }); });
Comments
Post a Comment