I’m dynamically filling a <ul data-role="listview"> then calling location.href="#Results" where the list is, and finally listview('refresh').
All that is done in the success callback of an Ajax request from the same page. It works more or less but I’m getting the following error:
Uncaught cannot call methods on listview prior to initialization; attempted to call method 'refresh'
I guess jQuery mobile did not construct the listview yet. What could I do?
http://jquerymobile.com/demos/1.1.0/docs/api/events.html
You have to hook on the pageinit event. You can’t call any JQM methods prior to this.
i.e.: