stevember Posted March 11, 2010 Share Posted March 11, 2010 I am fairly new to do jQuery and JavaScript, I am trying to pass a variable to a function and then load the page with that variable on the end. It works absolutely fine if I typed the page rather than the variable in. function pageload(pagetoload){ $("#main-container").load("tabpages/buy.php?pg="pagetoload"&randn"+ Math.random()); }; pageload("index"); pagetoload does not seem to be sent? Link to comment Share on other sites More sharing options...
0 sweetsam Posted March 11, 2010 Share Posted March 11, 2010 It is not working because it should be... function pageload(pagetoload){ $("#main-container").load("tabpages/buy.php?pg=" + pagetoload + "&randn" + Math.random()); }; Link to comment Share on other sites More sharing options...
0 Kudos Veteran Posted March 11, 2010 Veteran Share Posted March 11, 2010 I'm impressed that the syntax highlighter screwed up the same way as the OP :D Link to comment Share on other sites More sharing options...
Question
stevember
I am fairly new to do jQuery and JavaScript, I am trying to pass a variable to a function and then load the page with that variable on the end.
It works absolutely fine if I typed the page rather than the variable in.
function pageload(pagetoload){ $("#main-container").load("tabpages/buy.php?pg="pagetoload"&randn"+ Math.random()); }; pageload("index");pagetoload does not seem to be sent?
Link to comment
Share on other sites
2 answers to this question
Recommended Posts