i've got an issue.
I'm a newbie in the world of jQuery Mobile, and with the ASP.Net MVC part I'm a little bit lost.
Here is my problem: In my mobile web site I want to change the navbar (that I use more like an appbar) buttons whereas I am on an Edit Page, or Home, etc....
So those pages (Edit, Show) are loaded in ajax, and on these pages I'm trying to fire an event like :
$(document).ready(function(){
alert("Hello !");
});
But after some researchs, i found that in JQM with Ajax, events doesn't work that way, but more like this :
$(document).bind('pageinit', function(){
alert("Hello !");
});
But this don't work for me (every page change the event is trigerred), maybe because in ASP.Net MVC Mobile we have only one data-role="page"
and the rest of the content are loaded in ajax in the data-role="content"
, so I really don't know how I can fire an event when my "Ajax Loaded Kind of Page" is loaded ?
I had tried to live/bind on the listview of one of these pages but that does not work either :
$("[data-role='listview']").live('pageinit', function () {
alert("hello");
});
To be more precise about what i'm trying to do :
In ASP.Net MVC, my layout (who his common to all my pages) has a div
with a data-role="page"
attribute. This data-role is unique to my all app, and need to deal with it.
But the fact is, when I load an other ASP.Net MVC Page in my code :
<div data-role="page" >
<div data-role="content"> Here my ASP.Net MVC Page</div>
</div>
I cannot use the $(document).bind('pagenit')
because i don' load a page (data-role=page) but just a part of a data-role="content"
.
If you have any idea I will be glad to hear (more read) it, thanks in advance and sorry if my english is not really "understandable".