So I have a asp.net mvc4 jquerymobile application. Page A has a link to Page B. In the bottom of the PageB.cshtml file, I have the following code
<script type="text/javascript">
console && console.log("portalUser (index) raw!!");
$(document).live('pageload'), function () {
console && console.log("portalUser (index) pageload!!");
}
$(document).live('pageinit'), function () {
console && console.log("portalUser (index) pageInit!!");
}
$(document).live('pageshow'), function () {
console && console.log("portalUser (index) pageshow!!");
}
$(document).live('pagechange'), function () {
console && console.log("portalUser (index) pagechange!!");
}
$(document).ready(function () {
console && console.log("portalUser (index) document ready!!");
});
</script>
When accessed from PageA (via jqm's ajax loading), the console logs show :
portalUser (index) raw!!
portalUser (index) document ready!!
When accessed at PageB directly :
portalUser (index) raw!!
portalUser (index) document ready!!
Exactly the SAME! Now, according to jqm's own internal documents, we should be using $(document).live(....); to create these bindings.... but my tests show that
$(document).ready(function () {}` is the only one that works...
So, have I done something wrong? What am I missing? Thanks!