Menu
Is there a plugin-less way of retrieving query string values via jQuery (or without)?
If so, how, and if not what plugin do you recommend?
<i>
</i><html>
<head>
<script type="text/javascript">
function getQuerystring(){
var q=document.location.toString();
q=q.split("?");
q=q[1].split("&");
var str=""
for(i=0;i<q.length;i++){
tmp=q[i].split("=")
str+=i +". querystring name is '"+tmp[0]+"' value is '"+tmp[1]+"'<br />"
}
document.getElementById("results").innerHTML=str
}
onload=function(){
getQuerystring()
}
</script>
</head>
<body>
<div id="results"></div>
</body>
</html>
The property [I]search[/I] ([I]document.location.search[/I]) gives immediately the query portion of a URL(with the ? character). Seelocation object [/QUOTE]
it's often easier to deliver scripts as a bundle and let them sort themselves out without help from the server. this could mean, for example, loading an additional validation lib when a form page is offered, or a gallery script if a slideshow is presented.
[/QUOTE]
there's also applications for custom error messages based on failed GET form submits,
[/QUOTE]
and the potential to use a querystring to store the application's state. This lets the back button change app state all at once,
[/QUOTE]
in short, there a lot the server can't do, especially without internet,
[/QUOTE]
but GET params are a common way to store and share small chunks of data independently of the domain, application, or server implementation.
[/QUOTE]
Hi rnd me
Sorry bud, but I just don’t buy it
In short I remain unconvinced that this is a good approach, or even useful.
V[/QUOTE]
A simple example : to retrieve a post on a page, it could be useful to send and return the scroll height in a query string...[/QUOTE]
I see your point, but, lets say you append the querystring of some forum page with something like “&sh=464” to give you the value of the scroll height, if you want to retrieve that value client side you will need to write a function to parse it out of the querystring then write another function to scroll the page to the value: whereas if you were to do it server side all you would need to do is write the one function to scroll the page and add the value server side, surely that is far easier.[/QUOTE]
0.1.9 — BETA 6.17