• 0

[jQuery]Simple var problem but I'm stumped


Question

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

  • 0

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.