Leer los datos GET

1
2
function getUrlVars() {
var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Considerando la URL:
http://www.example.com/?me=myValue&name2=SomeOtherValue
Llamando a la funcion getUrlVars() nos devolverá un arreglo con la siguiente estructura:
{
"me" : "myValue",
"name2" : "SomeOtherValue"
}
Para obtener el valor del primer registro lo hacemos del siguiente modo:
var first = getUrlVars()["me"];

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.