A页面
mui.ajax('http://14.50.2.49:80/default/AppLogin?Prm=' + Prm, { data: {}, //dataType: 'json', type: 'Post', timeout: 10000, success: function(data) { //var res = eval('('+data+')'); console.log(data.State + "==" + data); if(data.State == undefined) { var res = eval('(' + data + ')'); //console.log('成功1'+res.State); if(res.State == 0) { mui.toast("data.Desc:"+res.Desc); //console.log(JSON.parse(res.Data)); //console.log(res.Data); //console.log(res.Data.Uguid+"-"+res.Data.Token+"-"+res.Data.UCName+"-"+res.Data.OrgInfo.Orgguid); mui.openWindow({ url: 'mainIndex.html', id: 'mainIndex.html', extras: { UserIds:res.Data.Uguid, Tokens:res.Data.Token, UCNames:res.Data.UCName, Orgguids:res.Data.OrgInfo.Orgguid } }); } } else if(data.State == 3) { //console.log('账户密码错误!'); mui.toast(data.Desc); } else { //console.log('登录失败'); mui.toast(data.Desc); } }, error: function(xhr, type, errorThrown) { mui.toast('失败'); } });
B页面 接收值
mui.plusReady(function(){ //webview是个对象 var sData = plus.webview.currentWebview(); mui.toast(sData.name); //mui是选择器 var name2 = mui('#Logname'); //注意:这里虽然获取的是一个id但赋值的时候也要用name2[0],这里获取的是一个数组 name2[0].innerHTML = sData.name; var age2 = mui('#age'); age2[0].innerHTML = sData.age; })