Author: Yang Guo from the bodhi tree Source: blog Park Release Date: Reading: 371 Original article links [favorites]
A while ago I sent an article using ExtJs ScriptTagProxy to implement Ajax cross-origin request (http://www.cnblogs.com/yjmyzz/archive/2008/09/14/1290789.html), these days I read Jquery, it is found that using getScript in JQuery is actually easier (jquery 1.2.6)
The code is provided here, and it is helpful for friends who are difficult to cross-origin Ajax:
Code
<Html>
<Head>
<Title> JQuery learning </title>
<Script src = "jquery-1.2.6.min.js" type = "text/javascript"> </script>
<Script type = "text/javascript">
$ (Document). ready (function (){
Var oBtnTest =$ ("# btnTest ");
OBtnTest. click (function (){
OBtnTest. disabled = true;
Var oResult = $ ("# result ");
OResult.html ("loading" ).css ("color", "red ");
JQuery. getScript ("http://app.cntvs.com/test/js.txt ",
Function (){
OResult.html ("name:" + jimmy. name + "<br/> email:" + jimmy.email#.css ("color", "black ");
OBtnTest. disabled = false;
});
});
});
</Script>
</Head>
<Body>
<Button id = "btnTest"> BtnTest </button>
<Div id = "result"> </div>
</Body>
</Html>
The contents of the remote server js.txt are as follows:
Var jimmy = {name: "jimmy. yang", email: jimmy.yang@163.com}
Is it simpler than ExtJs's ScriptTagProxy? I personally feel that Jquery is simple and clear, short and lean, ExtJs is powerful, and rich in components!