Reputation: 521
OK, after many hours of confusion I have discovered that calling page() on Jquery Mobile elements only works once.
What do I do if I want to update a form multiple times via AJAX?
Upvotes: 1
Views: 6343
Reputation: 16915
update
jQuery Mobile beta2 introduces a create
event..trigger('create')
applies JQM enhancements to an element and its children.
See: http://jquerymobiledictionary.pl/faq.html
You have to use it only once for an element. No exceptions yet.
if $('#container')
is your element, and you replace its content with AJAX, then there are two things you can do:
.page()
on $('#container').children()
.page()
on it.The second option is better if your content needs to be wrapped (like a list) and I'd recommend it in general.
If you are using a listview or something take a look at .listview('refresh')
or other dedicated methods.
Upvotes: 8
Reputation: 11
After several workarounds that did not meet my needs, I found this particular statement: remove or overwrite an existing div and call .page() on new div. This works best if content has to be reloaded / re-rendered / refreshed more than once.
Upvotes: 1