I'd like to apply autogenerated jQuery Mobile style (classes jQuery Mobile applies on page loading) after additionnal content loading via Ajax.
I load some content via Ajax which is parsed and organised into a <ul>
, but the style jQuery usually applies on page loading isn't applied again on the Ajax loaded content.
Just reload the header.
This is website works fine on any desktop browser but does not work on any mobile browser.
Previously, ASP.NET MVC applications could easily check if a request was being made via AJAX, through the aptly named IsAjaxRequest() method which was an available method on the Request object, as shown below: public ActionResult YourActionName() { // Check if the request is an AJAX call.
Assuming your ul is a jquery-mobile "listview", try to refresh the entire list by using :
$('#yourlist').listview('refresh');
jQuery Mobile doucmentation http://jquerymobile.com/demos/1.0a2/#docs/forms/plugin-eventsmethods.html
I was having troubles with this refresh method as well, got it working after a bit more searching by removing 'refresh', ie :
$('#yourlist').listview();
Found with explanation at http://forum.jquery.com/topic/wish-listview-refresh-would-go-away. Works ok in 1.1.1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With