易截截图软件、单文件、免安装、纯绿色、仅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("


相关文档:

Ajax 和 XML: 五种常见 Ajax 模式

好久不碰WEB的东东了,最近学习SAP的BSP技术,又用到这些,顺便转篇文章,备查.
原文地址: http://www.ibm.com/developerworks/cn/xml/x-ajaxxml2/
Ajax 和 XML:

种常见 Ajax 模式
可立即使用这些非常有用的 Ajax 设计模式
文档选项
<tr valign="top"><td width="8">< ......

asp.net在用ajax的时候如何弹出对话框


<form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
    <asp:updatepanel ID="UP" runat="server">
      <ContentTemplate>
......

AJAX DWR

使用原始的XMLHttpRequest发出请求时,只能对Servlet和JSP操作
在JSP中创建3个function
1.createXmlHttpRequest----负责判断浏览器类型创建 XMLHttpRequest对象
 var xmlHttpRequest;
 function createXMLHttpRequest(){
   // IE 浏览器
   if(window.ActiveXObject){
&nbs ......

ajax入门

描述:Ajax基础 在进行Ajax开发以前,我们必须先对一些基本的知识进行了解。虽然Ajax.NET已经将Ajax实现细节封装起来,并大大简化
Ajax基础
在 进行Ajax开发以前,我们必须先对一些基本的知识进行了解。虽然Ajax.NET已经将Ajax实现细节封装起来,并大大简化了我们的操作,但是了解基 本的Ajax实现方式对于帮助我们在开发中 ......

ASP.NET 2.0 AJAX中Webservice调用方法

ASP.NET 2.0 Ajax中能够在客户端js中很方便地调用服务器Webservice,以下为一些调用的示例。笔者安装的ASP.NET 2.0 AJAX
版本为AJAX November CTP。
三个示例分别为:
1 带参数的WS方法
2 不带参数的WS方法
3 参数类型为DataTable的WS方法
一、WebMethod
注意要点:
1 WebMethod类需要添加命名空间 Microsoft.Web. ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号