<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[[实践Ok]jQuery JSONP跨域实践，getJSON跨域实践。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[WEB2.0]]></category>
<pubDate>Wed, 14 Apr 2010 06:55:15 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	为什么jquery-jsonp总是执行error里的方法 ,PHP里也一样的拼写才成:<br/>后台服务器响应的内容有区别的<br/><br/>用 json 的时候<br/>response.write(&quot;&#123;&#92;&quot;p1&#92;&quot;:&#92;&quot;v1&#92;&quot;&#125;&quot;)<br/>用 jsonp 的时候<br/>response.write(request[&quot;callback&quot;] + &quot;(&#123;&#92;&quot;p1&#92;&quot;:&#92;&quot;v1&#92;&quot;&#125;)&quot;) <br/>——————————————————————————————————————————<br/>直接返回：callBackFromPcClient(&#123;&#039;title&#039;:&#039;this from server site&#039;,&#039;status&#039;:&#039;success&#039;&#125;)<br/>在里面写个callBackFromPcClient是不标准的，呵呵。<br/>PHP:<br/><textarea name="code" class="php" rows="15" cols="100">
&lt;?php
$array_Json = array(&quot;title&quot;=&gt;&quot;this from server site&quot;,&quot;status&quot;=&gt;&quot;success&quot;);
$aaa_arr = json_encode($array_Json);
$str =$_GET[&#039;callBackFromPcClient&#039;].&quot;(&quot;.$aaa_arr.&quot;)&quot;;
echo $str;
?&gt;
</textarea><br/>JS Jquery jsonP调用:<br/><textarea name="code" class="JS" rows="15" cols="100">

&nbsp;&nbsp;$.ajax(&#123;
&nbsp;&nbsp;&nbsp;&nbsp;type: &quot;post&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//http请求方式
&nbsp;&nbsp;&nbsp;&nbsp;async:false,
&nbsp;&nbsp;&nbsp;&nbsp;url: &quot;http://localhost/jsonp.php?random=&quot;+Math.random(),&nbsp;&nbsp;&nbsp;&nbsp;//服务器段url地址
&nbsp;&nbsp;&nbsp;&nbsp;timeout : 6000,//超时时间
&nbsp;&nbsp;&nbsp;&nbsp;dataType: &quot;jsonp&quot;, //告诉JQuery返回的数据格式
&nbsp;&nbsp;&nbsp;&nbsp;jsonp:&quot;callBackFromPcClient&quot;,&nbsp;&nbsp; &nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;success:function(data)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(data.status == &quot;success&quot;)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//$(&#039;#downLoadVideoByPcClient&#039;).attr(&quot;src&quot;,&quot;down://4cbe0e68-56e0-11e1-b474-a4badb4689bc&#124;justwinit.justwinit&quot;); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.location.href=&quot;down://4cbe0e68-56e0-11e1-b474-a4badb4689bc&#124;justwinit.justwinit&quot; &nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;else&#123;//PC客户端返回异常
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = &quot;http://jackxiang.com/&quot; + &quot;download.html&quot;;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; 
&nbsp;&nbsp;&nbsp;&nbsp;&#125;,&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;error : function(xhr,textStatus)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(textStatus==&#039;timeout&#039;)&#123;//处理超时的逻辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;timeOut&quot;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = &quot;http://jackxiang.com/&quot; + &quot;download.html&quot;;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125; else&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//其他错误的逻辑
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;timeOutExcept&quot;);&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.location.href = &quot;http://jackxiang.com/&quot; + &quot;download.html&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&#125;)
</textarea><br/>调用后返回：<br/><textarea name="code" class="JS" rows="15" cols="100">
jQuery18309774495864731751_1394706090108(&#123;&quot;title&quot;:&quot;this from server site&quot;,&quot;status&quot;:&quot;success&quot;&#125;)
</textarea><br/><br/>如不这样，会进入Error里的。Add Time：2014-03-13<br/>———————————————————————————————————————————————————————————————————————<br/>一直对jQuery 的jsonp 调用比较疑惑，今天研究了一下jsonp 做了一个简单的调用例子,我用asp做服务端s<br/><br/>客户端(url:http://192.168.1.2:81/jsonp_test.asp)<br/><br/>客户端页面首先在body 中放置一个div: &lt;div id=&quot;res&quot;&gt;&lt;/div&gt; 将远程调用的数据写入该div中<br/>Code<br/><br/><div class="code">&lt;script type=&quot;text/javascript&quot; src=&quot;/js/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;<br/>&lt;script type=&quot;text/javascript&quot;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$(document).ready(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.ajax(&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:&#039;http://192.168.9.5/jsonp_proc.asp&#039;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dataType:&quot;jsonp&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jsonp:&quot;jsonpcallback&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success:function(data)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var $ul = $(&quot;&lt;ul&gt;&lt;/ul&gt;&quot;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $.each(data,function(i,v)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&quot;&lt;li/&gt;&quot;).text(v&#91;&quot;id&quot;&#93; + &quot; &quot; + v&#91;&quot;name&quot;&#93;).appendTo($ul)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(&quot;#res&quot;).append($ul);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&lt;/script&gt;</div><br/><br/> <br/><br/>服务端（url:http://192.168.1.5/jsonp_proc.asp）<br/>代码很简单，就是输出一个字符串<br/>比如正常输出json应该是：[&#123;&quot;id&quot;:&quot;1&quot;,&quot;name&quot;:&quot;测试1&quot;&#125;,&#123;&quot;id&quot;:&quot;2&quot;,&quot;name&quot;:&quot;测试2&quot;&#125;]<br/>jsonp 则输出: jsonpcallback([&#123;&quot;id&quot;:&quot;1&quot;,&quot;name&quot;:&quot;测试1&quot;&#125;,&#123;&quot;id&quot;:&quot;2&quot;,&quot;name&quot;:&quot;测试2&quot;&#125;]) 其中“jsonpcallback”是客户端传过来的<br/><br/>Code<br/><br/><div class="code">&lt;%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;65001&quot;%&gt;<br/>&lt;%<br/>　　jsonp = request(&quot;jsonpcallback&quot;)<br/>　　str = &quot;&#91;&#123;&quot;&quot;id&quot;&quot;:&quot;&quot;1&quot;&quot;,&quot;&quot;name&quot;&quot;:&quot;&quot;测试1&quot;&quot;&#125;,&#123;&quot;&quot;id&quot;&quot;:&quot;&quot;2&quot;&quot;,&quot;&quot;name&quot;&quot;:&quot;&quot;测试2&quot;&quot;&#125;&#93;&quot;<br/>　　str = jsonp &amp;amp; &quot;(&quot; &amp;amp; str&amp;amp;&quot;)&quot;<br/>　　response.Write(str)<br/>%&gt;</div><br/><br/>由于 jquery 在ajax 处理中使用的是utf-8编码传递参数的，所以jsonp处理端用utf-8的编码最好，这样省得编码转换了<br/><br/>最终效果截图：<br/><br/><a href="http://jackxiang.com/attachment.php?fid=94" target="_blank"><img src="http://jackxiang.com/attachment.php?fid=94" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>跨域可能想flash来做其实jsonp这样去请求计数一下还是可以的：<br/><br/><br/><div class="code"><br/>&nbsp;&nbsp;&nbsp;&nbsp;start:function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $.ajax(&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:&#039;http://c.l.**.com/adsclick?seq=20100414000034***&amp;loc=hdjc**&#039;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dataType:&quot;jsonp&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jsonp:&quot;jsonpcallback&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success:function(data)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><br/><br/>服务端必须要有一个回调函数的json串输出，否则，jquery的jsonp尽管调用，但是没有到success里面去。<br/>为此，我们应该这样才能取得回调的json返回值：<br/><br/>PHP跨域Url代码：<br/>http://localhost/jsonp.php<br/><div class="code">&lt;?php<br/>$array_Json = array(&quot;id&quot;=&gt;&quot;10020155545&quot;,&quot;name&quot;=&gt;&quot;jackxiang&quot;);<br/>$aaa_arr = json_encode($array_Json);<br/>$str =$_GET&#91;&#039;jsonpcallback&#039;&#93;.&quot;(&quot;.$aaa_arr.&quot;)&quot;;<br/>echo $str;<br/>?&gt;</div><br/>jsonp url发送get方式抓包：<br/><div class="code"><br/>http://localhost/jsonp.php?jsonpcallback=jsonp1299201040354&amp;_=1299201040373<br/>jsonp1299201040354(&#123;&quot;id&quot;:&quot;10020155545&quot;,&quot;name&quot;:&quot;jackxiang&quot;&#125;)</div><br/><br/>jquery的jsonp调用如下：<br/><br/>jsonp.html<br/><div class="code">&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br/>&lt;head&gt;<br/>&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br/>&lt;title&gt;安踏CBA全明星赛活动 - 排行榜&lt;/title&gt;<br/>&lt;script type=&#039;text/javascript&#039; src=&quot;./jquery.js&quot;&gt;&lt;/script&gt;<br/><br/><br/>&lt;script type=&quot;text/javascript&quot;&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$(document).ready(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$.ajax(&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:&#039;http://localhost/jsonp.php&#039;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dataType:&quot;jsonp&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jsonp:&quot;jsonpcallback&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success:function(data)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(&quot;jack&quot;);<br/>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; alert(data);<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;);<br/>&lt;/script&gt;</div><br/><br/>来源：http://www.cnblogs.com/cfanseal/archive/2009/05/19/1460382.html<br/>http://www.impng.com/front-end/ajax-crossdomain-by-jsonp.html<br/><br/><br/><textarea name="code" class="JS" rows="15" cols="100">
para.id = d;
$.getJSON(&quot;http://10.21.12.108/svnregister.php?callback=?&quot;,para,function(jd)&#123;
&nbsp;&nbsp;if(jd.code&nbsp;&nbsp;== 0)&#123;

&nbsp;&nbsp;&#125; else &#123;
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&#125;
</textarea><br/><br/><br/><br/><br/>最近遇到不少需要跨越操作的问题，一直没有解决，今天具体总结下Jquery下怎样实现跨域操作的。<br/>一般情况下，XMLHttpRequest对象本身是不能支持跨域通信的，因此使用简单的AJAX技术是无法完成跨域请求与响应的任务的。为了实现跨域通信，实现跨域操作有三种方法：<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本地代理，flash，Script。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.Script实现跨域操作（通过getScript()函数）<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getScript(&quot;网址&quot;)；<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.Jsonp方式实现跨域操作（使用jQuery的JSONP就可以实现跨域操作）<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getJSON(&quot;网址?type=json（类型）&amp;callback=?（返回）&quot;）；<br/>还有一些网址提供的API也可以实现跨域<br/><br/>jQuery的getJSON方法怎么使用?<br/><br/>$.getJSON(&#039;你请求的页面URL, &#123;参数&#125; , 回调函数);<br/>a.php<br/>$name = &#123;name:&quot;aaa&quot;&#125;;<br/>echo $name; //响应回去,如果换成其他语言用一个输出就行。<br/>//模板<br/>$.getJSON(&#039;a.php&#039; , &#039;&#123;&#125;&#039; , function(data)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;alert(data.name); //弹出aaa<br/>&#125;)<br/><br/>Demo：<br/>一定要有一个callback=?的回调参数，没有请求是失败的，不可能成功的：<br/><textarea name="code" class="php" rows="15" cols="100">
&nbsp;&nbsp;&nbsp;&nbsp;var id = $.query.get(&#039;id&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;var outerUrl = &quot;http://jackxiang.com.com/php/interface/getLastShenPisInfo.php?callback=?&amp;id=&quot;+id+&quot;&amp;rand=&quot;+Math.random();
&nbsp;&nbsp;&nbsp;&nbsp;$.getJSON(outerUrl , &#123;&#125; , function(data)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(data.type==&#039;pm&#039;)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&#039;#confirm-window &gt; p:last&#039;).after(&#039;&lt;font color=&quot;red&quot;&gt; 发布前提醒：此次业务发布需负责人审批!&lt;/font&gt;&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(data.type==&#039;leader&#039;)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&#039;#confirm-window &gt; p:last&#039;).after(&#039;&lt;font color=&quot;red&quot;&gt; 发布前提醒：此次业务发布需组长审批!&lt;/font&gt;&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(data.type==&#039;director&#039;)&#123;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(&#039;#confirm-window &gt; p:last&#039;).after(&#039;&lt;font color=&quot;red&quot;&gt; 发布前提醒：此次业务发布需总监审批!&lt;/font&gt;&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&#125;)
</textarea><br/><br/>程序端：<br/>需要返回数据结构如下：<br/>$ret = &quot;&#123;&#92;&quot;code&#92;&quot;:&#92;&quot;-1&#92;&quot;&#125;&quot;;<br/>echo $_GET[&#039;callback&#039;].&quot;(&quot;.$ret.&quot;)&quot;;<br/>根据情况于是得构造出：<br/>Url：./Info.php?callback=jsonp1342075892609&amp;id=566&amp;rand=0.1722637134335827<br/>jsonp1342075892609(&#123;type:&quot;pm&quot;&#125;)<br/>于是：<br/>$ret = &#039;&#123;type:&quot;pm&quot;&#125;&#039;;<br/>echo $_GET[&#039;callback&#039;].&quot;(&quot;.$ret.&quot;)&quot;;
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [实践Ok]jQuery JSONP跨域实践，getJSON跨域实践。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>