开发者

How to ger Url parameters with Sencha Touch

开发者 https://www.devze.com 2023-03-29 04:34 出处:网络
开发者_StackOverflow社区How can I get a parameter from the url? For example, if have: page1.html#token=12345

开发者_StackOverflow社区How can I get a parameter from the url? For example, if have:

page1.html#token=12345 

and I need to get the token from the url, how can I do that in sencha?


www.test.com/?drink=beer

var params = Ext.urlDecode(location.search.substring(1));
//substring(1) removes the question mark

console.log(params);
//Get the value of a key by using:
console.log(params.drink);


The best solution is to use Sencha's built-in routing functionality and pass your parameters as individual URI segments, i.e. www.webapp.com/user/param1/param2. This makes for cleaner URIs and you can use Sencha's map.connect() to setup the routes.


Ext.urlDecode("token=12345"); // returns {token: "12345"}

0

精彩评论

暂无评论...
验证码 换一张
取 消