My url looks like http://www.mysite.com/?action=top&id=5 or (through mod_rewrite) http://www.mysite.com/top/5
How can I get GET params in Sencha Touch? Search in Internet not give me working solution.
My url looks like http://www.mysite.com/?action=top&id=5 or (through mod_rewrite) http://www.mysite.com/top/5
How can I get GET params in Sencha Touch? Search in Internet not give me working solution.
このようなものがおそらくあなたを助けるでしょう:
Ext.Object.fromQueryString(window.location.search.substring(1));
ただし、これは mod_rewrite の例では機能しないため、window.location.search.length > 0 であることを確認し、そうでない場合は正規表現を実行して /top/5 部分を除外します。
編集: Ext.urlDecode が非推奨になったため、コードを変更しました。推奨されるメソッド (Ext.Object.fromQueryString) へのドキュメント リンクは次の とおりです。 docs.sencha.com - fromQueryString
indapublic訂正ありがとうございます!