脚本宝典收集整理的这篇文章主要介绍了php – 上传到服务器后不允许使用英特尔XDK Ajax访问[在xampp中运行良好],脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
XMLHttPRequest cannot load http://watanydemo.eb2a.COM/Metawe3/action/get?_=1451186106865. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not Allowed access. index.htML:92 {"readystate":0,"status":0,"statusText":"error"}
虽然我通过所有方式设置标题,但仍将原点设置为null
public function get() { $this->load->model('Name_model'); $result = $this->Name_model->read_names(); header('Access-Control-Allow-Origin: *'); header('Content-tyPE: application/json'); echo json_encode($result); }
我的Ajax调用是
<script type="text/javascript"> $(document).ready(function() { $('#loading-image').show(); try { $.ajax({ type: "GET",url: "http://watanydemo.eb2a.com/Metawe3/action/get",croSSDomain: true,contentType: "application/x-www-form-urlencoded",async: true,dataType: 'json',processData: false,cache: false,success: function (response) { alert("valid response"); for (VAR i = 0,res = response.length; i < res; ++i) { var picture = response[i].picurl; var name= response[i].name; $("#row").append('<div class="col-md-4"><h1>'+name+'</h1><img id="pic" class="thumbnail img-responsive" alt="Bootstrap template"src="'+picture+'" />'+'<div class="well"></div></div>'); } },complete: function(){ $('#loading-image').hide(); },error: function (ErrorResponse) { console.LOG(JSON.stringify(ErrorResponse)); } }); } catch (error) { console.log(JSON.stringify(error)); } }); </script>
以上是脚本宝典为你收集整理的php – 上传到服务器后不允许使用英特尔XDK Ajax访问[在xampp中运行良好]全部内容,希望文章能够帮你解决php – 上传到服务器后不允许使用英特尔XDK Ajax访问[在xampp中运行良好]所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。