1 / 2
文档名称:

ScriptTagProxy解决跨域json调用.doc

格式:doc   页数:2页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

ScriptTagProxy解决跨域json调用.doc

上传人:luyinyzhi 2016/7/14 文件大小:0 KB

下载得到文件列表

ScriptTagProxy解决跨域json调用.doc

相关文档

文档介绍

文档介绍:相信很多朋友有时候会调用一些跨域的 json, 这时候用 就不灵了, 也为我们提供了另一个专门跨域调用的类,, Ext 例子里面的代码: .JS 代码如下 1. // create the Data Store 2. var store = new ({ 3. // load using script tags for cross domain, if the data in on the same domain as 4. // this page, an HttpProxy would be better 5. proxy: new ({ 6. url: '/forum/topics-browse-' 7. }), 8. 9. // create reader that reads the Topic records 10. reader: new ({ 11. root: 'topics' , 12. totalProperty: 'totalCount' , 13. id: 'threadid' , 14. fields: [ 15. 'title' , 'forumtitle' , 'forumid' , 'author' , 16. {name: 'replycount' , type: 'int' }, 17. {name: 'lastpost' , mapping: 'lastpost' , type: 'date' , dateFormat: 'timest amp' }, 18. 'lastposter' , 'excerpt' 19. ] 20. }), 21. 22. // turn on remote sorting 23. remoteSort: true 24. }); 25. ( 'lastpost' , 'desc' ); topics-browse- 1. <?php 2. //Create json 3. $json_data = "......" ; 4. // Grab the callback variable sent with every ScriptTagProxy request 5. $callback = $_REQUEST[ 'callback' ]; 6. // Return the JSON string within the callback function, so ExtJ