I am developing an application using jQuery 1.3.1 and a phone table 2.9.0.
All ara data is downloaded dynamically from the server using php. My problem is that the update call does not work every time the list items are changed. I already tried a lot and searched a lot. I think the refresh function is called before the list ends, but it doesn't work anywhere I try to put this line of code.
Any help?
here is my list
<ul data-role="listview" data-autodividers="true" id="listview1" data-divider-theme="b" data-split-theme="b" data-filter-theme="b" data-split-icon="phone" data-filter="true" data-filter-placeholder="Search..." ></ul>
this is how i make ajax call to server
$.ajax({url: JsonURL beforeSend: function(){ $.mobile.showPageLoadingMsg('b', 'Updating content...', true); }, complete: function () { console.log("refreshing.."); $('#listview1').listview('refresh'); $('#listview2').listview('refresh'); $('#listview3').listview('refresh'); $.mobile.hidePageLoadingMsg(); }, contentType: "application/json; charset=utf-8", dataType: "json", async: true, success: function (result) { data = result; app.setupdevice(); $.mobile.changePage('#home', {transition: 'slide'}); }, error: function (request, error) { console.log(error.message); } });
and this is how i create a listview. This code is run every time the list items are modified to update the list with new items.
In the success function, I call setupdevice , which initializes the lists, as shown below. Then in the full function, I update the listview. For some reason, it only refreshes the first time.
items=''; $.each(data.pois, function() { items += '<li><a href="#"><h3>'+this.name+'</h3></a><a href="tel:\''+this.tel+'\'" >call</a></li>'; }); $('#listview1').html(items);
This is the first time I have come to this problem, and I am really annoyed because I cannot find why this is happening.