How to retrieve the current querystring values using mootools
How to retrieve the current querystring values using mootools.
I am using mootools ajax for php pagination. Following parameters are passing with my first call
format=html&nolayout=true&p[0]=1000-15开发者_Python百科00&p[1]=1500-2000&p[2]=2000-2500
and for the second ajax call should retain the above all parameters and need to attach one more parameter as follows
format=html&nolayout=true&p[0]=1000-1500&p[1]=1500-2000&p[2]=2000-2500&pagenum=1
How to do this.any help please
You could simply use window.location.search
i.e.
Get the current QS and remove the first character ?
, and also &pagenum=X
(replace + regexp), then append the new param and send your ajax request.
var currQueryString = window.location.search.substring(1), //and also remove '&pagenum=X' (see above)
newQueryString = currQueryString + "&pagenum=1"; //obv, pagenum should be dynamic, this is just an example
new Request({ //or Request.HTML...
url : 'http://some/url' // ...and other options
}).send(newQueryString);
精彩评论