Home  >  Article  >  Backend Development  >  Set cookies or get cookies across domain names_PHP tutorial

Set cookies or get cookies across domain names_PHP tutorial

WBOY
WBOYOriginal
2016-07-20 11:14:491372browse

You can use jsonp in ajax in jquery to access it. The code is as follows:

<span  1</span> <span $.ajax({
</span><span  2</span>     url: 'your url'<span ,
</span><span  3</span>     data: {'xx' : 'xx', 'xx2' : 'xx2'<span },
</span><span  4</span>     success: <span function</span><span (data){    
</span><span  5</span>         <span //</span><span 成功后执行的</span>
<span  6</span> <span     },
</span><span  7</span>     type:'GET'<span ,
</span><span  8</span>     dataType: 'jsonp',<span //</span><span 重要的是这个</span>
<span  9</span>     jsonp: "callback"<span ,
</span><span 10</span>     jsonpCallback:"jsonpReturn"
<span 11</span> });

You can write this in php:

<span 1</span> <span function</span><span  login()
</span><span 2</span> <span {
</span><span 3</span>     <span return</span> 'jsonpReturn('.jsondecode(<span $array</span>).')'<span ;
</span><span 4</span> }

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/440253.htmlTechArticleYou can use jsonp in ajax in jquery to access it. The code is as follows: url: 'your url' data: {'xx' : 'xx', 'xx2' : 'xx2' success: type:'GET' dataType: 'jsonp',...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn