azicchetti / jquerymobile-router

A router/controller for jquery mobile. Also adds support for client-side parameters in the hash part of the url. The routes handles regexp based routes. This plugin can be used alone or (better) with Backbone.js or Spine.js, because it's originally meant to replace their router with something integrated with jQM.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

changePage problem.

rendom opened this issue · comments

Hi im testing out this plugin and i really like it.
But i just notice one problem, i think i have misunderstood something but i hope someone can help me out here :).

I run jQuery.mobile.changePage( "address.html?id="+String(data), { transition: "slide"} );
and its working fine but my handler dosent get trigged.

My router
var router=new $.mobile.Router({
"/address.html(?:?)?": {handler: "address", events: "s"},
},{
address: function(type, match, ui) { alert("hej"); }
});

Hi,
I'm glad you find it useful ;)

I guess the problem is the regexp, since it starts with "/".
Can you try

 $.mobile.changePage("./address.html?id="... etc?)

to see if it solves the problem?

Cheers

Hm github destroyed the regex, check here insted http://cl.ly/3h1y391S0F1p1Z2E1T3q
I tested to run this jQuery.mobile.changePage( "address.html", { transition: "slide"} ); but i get the same result, the page changes correct but no alert.

The regexp is fine, try changing the .changePage line to:

jQuery.mobile.changePage( "./address.html", { transition: "slide"} );

Prefixing the page name with "./" ensures that the regexp will always match.

Yeh i just notice that my page dosent got loaded correctly :)
Thanks for the help and support :), back to developing my "app" ;).