play framework java[1.2.5] Adding markers on a Google map from a page

84 views
Skip to first unread message

gokool

unread,
Dec 7, 2012, 8:09:11 PM12/7/12
to play-fr...@googlegroups.com
I am trying to convert a single page webapp built earlier using jquery to a Play app since now the application has requirements to grow into a multi-page app. The application is primarily a search front end that renders results (with locations) on a Google Maps UI.
In the original version using jQuery, in the callback from the AJAX invocation, I would add new markers to the "Google Maps" object which is globally defined.
However, using Play template my "Google Maps" object is defined only in main.html. So how does one make the add-Marker method call to the Google maps object from another page i.e. search.html.
More specifically from where should i make it. search.html extends main.html but when the browser executes the section where I try to access the Google-Maps object, it says "Uncaught Reference error: map is not defined"

Any pointers would be appreciated.

hans

unread,
Dec 11, 2012, 9:43:08 AM12/11/12
to play-fr...@googlegroups.com
Gokoo,

If your search.html page extends main.html, for your browser it is just one page with the contents of search inside main.html, this means that any global javascript variable defined in main is available in search too.

If you are using firefox, i recommend to install firebug with the console open.

Good luck
Hans
Reply all
Reply to author
Forward
0 new messages