易截截图软件、单文件、免安装、纯绿色、仅160KB

AJAX Cross Domain Same Origin Policy limitation

摘自:http://www.ibm.com/developerworks/library/wa-aj-jsonp1/
AJAX Same-Origin Policy(SOP) limitation:
 AJAX prevents cross-domail invokation, there are several ways to by pass this limitation.
1. write a proxy on the server side. The SOP limitation only exists only on the javascript side.  While on the side, we can still invoke the other domail url such as via HttpClient
2. iFrame ( not sure )
3. JSONP(JSON with Padding)
the same-origin policy doesn't prevent the insertion of dynamic script elements into the document. That is, you could dynamically insert JavaScript from different domains, carrying JSON data in them.
<mce:script type="text/javascript"><!--
// This is our function to be called with JSON data
function showPrice(data) {
alert("Symbol: " + data.symbol + ", Price: " + data.price);
}
var url = “ticker.js”; // URL of the external script
// this shows dynamic script insertion
var script = document.createElement('script');
script.setAttribute('src', url);
// load the script
document.getElementsByTagName('head')[0].appendChild(script);
// --></mce:script>
Note that, in order to do this, you must have a callback function already defined in the Web page at the time of insertion.
Beginning with version 1.2, jQuery has had native support for JSONP calls. You can load JSON data located on another domain if you specify a JSONP callback, which can be done using the following syntax: url?callback=?.
AJAX invoke:
jQuery.getJSON("http://www.yourdomain.com/jsonp/ticker?symbol=IBM&callback=?",
function(data) {
alert("Symbol: " + data.symbol + ", Price: " + data.price);
});

Another domain generates json data and returned to client side with callback function.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
String jsonData = getDataAsJson(req.getParameter("symbol"));
String output = req.getParameter("


相关文档:

jQuery Ajax 回顾

     在本节我准备只写上关于Ajax的说明,多数来自jQuery的帮助文档,所以不要放在首页。因为我觉得首页应该是要花费了时间和心思的作品。代码演示和jQuery Ajax 一些新的,将在下一次有空时讲述,这里就不讲了。时间已经0晨了。如果你举得有什么jQuery的疑问或者觉得Ajax该讲述那些内容的都可以跟我留 ......

AJAX中DragPanelExtender扩展控件


页面代码:
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManage ......

Ajax 的状态介绍

在《Pragmatic Ajax A Web 2.0 Primer 》中偶然看到对readyStae状态的介绍,感觉这个介绍很实在,摘译如下:
0: (Uninitialized) the send( ) method has not yet been invoked.
1: (Loading) the send( ) method has been invoked, request in progress.
2: (Loaded) the send( ) method has completed, entire respons ......

流行的AJAX框架对比:jQuery,Mootools,Dojo,Ext JS

AJAX
是web2.0
的基石,现在网上流行几种开源的AJAX框架,比
如:jQuery,Mootools,Dojo,Ext JS等等,那么我们到底在什么情况下该使用那个框架?以下是一组摘抄的数据:
Ajaxian在2007年底对Ajax工具进行了调查,部分调查结果见下表(其中数字为调查者使用该工具的百分比,详细的请参见网页):http://ajaxian.com/archi ......

Ajax框架介绍

  到此为止,你可能已经注意到,使用Ajax编程时有很多麻烦事。如果你要支持多个浏览器(现在还有谁只支持一个浏览器呢?),无疑会遭遇不兼容问题。单看一个简单的动作,比如说创建XMLHttpRequest对象的一个实例,这需要先进行浏览器测试。一旦开始尝试使用Ajax技术,你很快就会注意到要反复地完成同样的一些任务。当然, ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号