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.
GNU General Public License v2.0
402 stars 69 forks source link

Can this be used using two different html files? #85

Open miggymamba opened 9 years ago

miggymamba commented 9 years ago

Hi,

My index.html contains a name , a latitude and a longitude. When I click on the link, the href must pass the name and the coordinates to my map.html so I can put a marker on my map. Is this possible? Thanks.

azicchetti commented 9 years ago

Il 03/11/2014 10:24, mrhwangmiyoung ha scritto:

Hi,

My index.html contains a name , a latitude and a longitude. When I click on the link, the href must pass the name and the coordinates to my map.html so I can put a marker on my map. Is this possible? Thanks.

Hi, yes, it's definitely possible.

You can use a separate page (map.html) in ajax mode, with a href such as "map.html?la=XX.XXXXXX&ln=YY.YYYYYY", or a local page with a certain id (#map) with a href such as "#map?la=XX.XXXXXX&ln=YY.YYYYYY".

Cheers, Andrea

miggymamba commented 9 years ago

Hi andrea,

I'll try to do implement it. I am still new to Web Technologies. I'll get back to you. I hope you can help me. Thanks.

miggymamba commented 9 years ago

Hi Andrea,

It seems that I can't make it work. I have this:

"map.html?param=value&param2=value" 

then I have this in my router:

"map: function (type,match,ui){
     //loading('show');
     var params=router.getParams(match[0]);
      console.log("mapRouter: "+type+" "+match[1]);
      console.log(params);

 }"  

There is no log in the console. Any ideas why this happens? Thanks.

azicchetti commented 9 years ago

Hi, here you can fine a working example using gmaps and jQM ajax mode: https://dl.dropboxusercontent.com/u/39794383/map.zip

It can be refined, it should take into account page caching and so on, but it's still a good starting point. Hope it can help somehow.