2011-08-05 84 views
0

如何使用mootools檢索當前查詢字符串值。如何使用mootools檢索當前查詢字符串值

我正在使用mootools ajax for php分頁。下面的參數傳遞與我的第一個電話

format=html&nolayout=true&p[0]=1000-1500&p[1]=1500-2000&p[2]=2000-2500 

和第二Ajax調用應保留上述的所有參數,需要附加一個參數如下

format=html&nolayout=true&p[0]=1000-1500&p[1]=1500-2000&p[2]=2000-2500&pagenum=1 

怎麼辦this.any幫助請

回答

0

你可以簡單地使用window.location.search

獲取當前QS並刪除第一個字符? ,還有&pagenum=Xreplace + regexp),然後附加新的參數併發送您的ajax請求。

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); 
相關問題