hello, i'm a newbie using ROR.
i have this function below inside my public/application.js and i'm
wondering whether i can replace "San Fransisco" and "New York" in this
command "setDirections("San Francisco", "New York", "en_US");" with
session[:address1] and session[:address2]....???
Please can anyone show me how to do it...
"
function initialize() {
if (GBrowserIsCompatible()) {
alert("kyaaaaaaaa")
map = new GMap2(document.getElementById("map_canvas"));
gdir = new GDirections(map,
document.getElementById("directions"));
GEvent.addListener(gdir, "load", onGDirectionsLoad);
GEvent.addListener(gdir, "error", handleErrors);
setDirections("San Francisco", "New York", "en_US");
}
}
"
Thanks a lot Mikel... But now i really can't try whether it's working
or not... I think there's something wrong with my internet connection
now... after i see you code, i'm wondering, if it's possible to write
the code inside the application.js file like this code below :
"
function initialize() {
if (GBrowserIsCompatible()) {
alert("kyaaaaaaaa")
application.js isn't passed through erb, so no.
If I were you I'd make that initialize function take the 2 addresses as its arguments and call it from somewhere where you do have access to the session.
Thanks for the information Fred, i'm just confused from where i can
access the session...?? I still can't try the Mikel's solution, cause
i think there are troubles with my internet connection...
Mikel, I've tried what you suggested me to do. And the result is i got
an unknown error. After a few trial, i know that if i replace
"setDirections("<%= session[:address1] -%>", "<%= session[:address2] -
%>", "en_US");" with fixed command such as "setDirections("new york",
"boston", "en_US");" then the error will never showed up... In my
opinion, the setDirections function, somehow did not passing the right
parameters...
If you don't mind, would you share me any opinion...