Jump to content

[SOLVED] $_GET in javascript


plutomed

Recommended Posts

Can anyone see a problem with this:

 

 

 

function templates(num)

{

var url = window.location.href;

var qparts = url.split("?");

var varname = "num_pgs";

var value = "";

 

if(qparts.length == 0)

{

return "";

}

var vars = qparts.split("&");

 

for(i=0; i<vars.length; i++;)

{

var parts = vars.split("=");

if(parts[0] == varname)

{

value = parts[1];

break;

}

}

 

if(num == value)

{

document.getElementById("templates").innerHTML = "";

}

}

 

Link to comment
https://forums.phpfreaks.com/topic/71085-solved-_get-in-javascript/
Share on other sites

if you just want to get the parameters in the url useing javascript there are plenty to find online

 

here is one that works

http://ilovethecode.com/Javascript/Javascript-Tutorials-How_To-Easy/Get_Query_String_Using_Javascript.shtml

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.