Simple Way to Extract GET Params from a JavaScript Script Tag
1–10 of 26 posts
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#2Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#3Doesn't support multiple keys with the same name, which is valid and not particularly uncommon. I wouldn't be surprised if it breaks in other ways. This kind of thing is always full of subtle pitfalls.
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#4Doesn't support multiple keys with the same name, which is valid and not particularly uncommon. I wouldn't be surprised if it breaks in other ways. This kind of thing is always full of subtle pitfalls.
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#5Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#6Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#7Doesn't support multiple keys with the same name, which is valid and not particularly uncommon. I wouldn't be surprised if it breaks in other ways. This kind of thing is always full of subtle pitfalls.
multiple keys with the same name? what do you mean? arrays?
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#8 AddHandler server-parsed .js
then add: (function(query_string){
...
})("");
around your script. This obviously has problems with caching, but it doesn't have the problems addressed with those "heavy loads" that you have with PHP et al.Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#9Here's a simpler way. Put this in your htaccess file: AddHandler server-parsed .js then add: (function(query_string){ ... })(" "); around your script. This obviously has problems with caching, but it doesn't have the problems addressed with those "heavy loads" that you have with PHP et al.
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#10Doesn't support multiple keys with the same name, which is valid and not particularly uncommon. I wouldn't be surprised if it breaks in other ways. This kind of thing is always full of subtle pitfalls.
multiple keys with the same name? what do you mean? arrays?
If you're familiar with Django, this is why the GET, POST and other request dictionaries are actually MultiValueDicts. If you call request.GET.getlist('varname') instead of request.GET['varname'], you'll get a list of each value passed with that name. The brackets aren't special, and if you used them, you'd need request.GET.getlist('varname[]').