jianmin215@126.com
jianmin215@126.com
  • 发布:2016-10-17 09:53
  • 更新:2016-10-17 10:32
  • 阅读:2569

mui发起ajax请求,XMLHttpRequest cannot load问题

分类:MUI

mui.ajax({
type:'POST',
url:'http://localhost:8080/jhy/a/test_ce/testCe/test',
dataType:"json",
success:function(data){
var table = document.body.querySelector('.mui-table-view');
var cells = document.body.querySelectorAll('.mui-table-view-cell');
for(var i =0;i<data.length;i++){
var li = document.createElement('li');
li.className = 'mui-table-view-cell';
li.innerHTML = '<div class="mui-slider-cell">'+
'<div class="oa-contact-cell mui-table"><div class="oa-contact-avatar mui-table-cell">'+
'<img src="../images/298354-jOZMY9.jpg" style="width: 60px;height: 60px;"/>'
+'</div>'
+'<div class="oa-contact-content mui-table-cell">'
+'<div class="mui-clearfix">'
+'<h4 class="oa-contact-name">'+data[i].user.name+'</h4>'
+'</div>'
+'</div>'
+'</div>'
+'</div>'
}
}
});
这样发请求会出现"XMLHttpRequest cannot load http://localhost:8080/jhy/a/test_ce/testCe/test. The request was redirected to 'http://localhost:8080/jhy/a/login;JSESSIONID=f7940c11596245ecbeed0f9a956609f7', which is disallowed for cross-origin requests that require preflight." /MUIHello/examples/tab-webview-subpage-contact.html (0)这样的问题 请问怎样解决?求解!

2016-10-17 09:53 负责人:无 分享
已邀请:
MUI_Charles

MUI_Charles

未登录哈。跟后台沟通登录和跨域的问题

Trust

Trust - 少说废话

  • jianmin215@126.com (作者)

    mui.ajax({

    async:true,

    crossDomain:true,

    type:'POST',

    url:'http://localhost:8080/jhy/a/test_ce/testCe/test',

    dataType:"json",

    timeout: 1000,

    success:function(data){

    console.log(data[0].name+"11111");

    mui.alert(data[0].name);

    var table = document.body.querySelector('.mui-table-view');

    var cells = document.body.querySelectorAll('.mui-table-view-cell');

    for(var i =0;i<data.length;i++){

    var li = document.createElement('li');

    li.className = 'mui-table-view-cell';

    li.innerHTML = '<div class="mui-slider-cell">'+

    '<div class="oa-contact-cell mui-table"><div class="oa-contact-avatar mui-table-cell">'+

    '<img src="../images/298354-jOZMY9.jpg" style="width: 60px;height: 60px;"/>'

    +'</div>'

    +'<div class="oa-contact-content mui-table-cell">'

    +'<div class="mui-clearfix">'

    +'<h4 class="oa-contact-name">'+data[i].user.name+'</h4>'

    +'</div>'

    +'</div>'

    +'</div>'

    +'</div>'

    }

    }

    });

    这样吗?还是有那个问题

    2016-10-17 10:58

该问题目前已经被锁定, 无法添加新回复