My Notebook
2012年3月8日 星期四
[Titanium] Pass JSON object to webview Javascript function
webview.evalJS('somefunction('+jsonObj+')'); <--- Not work, jsonObj is treated as string
The correct way is
webview.evalJS('somefunction('+JSON.stringify(jsonObj)+')');
The opposite of JSON.stringify() is JSON.parse()
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言