I am using the following script:
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
var id_is = getQueryVariable("id");
document.write(id_is);
return(false);
}
This script should grab the variable value and display it on screen. It only works if I use getQueryVariable("id"); in the console but using the document.write method it doesn't work. What am I doing wrong?
document.write()probably. You'll have to post more about what you're doing and what your page looks like to get more specific help.