How do I simply get GET
and POST
values with JQuery?
What I want to do is something like this:
$('#container-1 > ul').tabs().tabs('select', $_GET('selectedTabIndex'));
How do I simply get GET
and POST
values with JQuery?
What I want to do is something like this:
$('#container-1 > ul').tabs().tabs('select', $_GET('selectedTabIndex'));
There's a plugin for jQuery to get GET params called .getUrlParams
For POST the only solution is echoing the POST into a javascript variable using PHP, like Moran suggested.
Use following function:
and access variables as
vars['index']
where'index'
is name of the get variable.You can try Query String Object plugin for jQuery.
jQuery plugins seem nice but what I needed is a quick js function to parse the get params. Here is what I have found.
http://www.bloggingdeveloper.com/post/JavaScript-QueryString-ParseGet-QueryString-with-Client-Side-JavaScript.aspx
replace VARIABLE_KEY with the key of the variable to get its value
why not use good old PHP? for example, let us say we receive a GET parameter 'target':