ajax请求在服务器返回结果时页面就提前刷新了是怎么回事,我没有写刷新页面的方法啊?
function addOrder(){
var recivepeople = document.getElementById("recivepeople").value.replace(/\s/g,"");
var mobile = document.getElementById("mobile").value.replace(/\s/g,"");
var address = document.getElementById("address").value.replace(/\s/g,"");
var optname = document.getElementById("optname").value.replace(/\s/g,"");
var price = document.getElementById("price").value.replace(/\s/g,"");
var count = document.getElementById("count").value.replace(/\s/g,"");
var io = document.getElementById("io").value.replace(/\s/g,"");
var money = document.getElementById("money").value.replace(/\s/g,"");
var remark = document.getElementById("remark").value.replace(/\s/g,"");
var sheng = document.getElementById("sheng").value;
var city = document.getElementById("city").value;
var region = document.getElementById("region").value;
if(recivepeople == '' || mobile == '' || address == '' || price == '' || count == ''
|| money == ''){
mui.toast('请将信息填写完整');
return;
}else{
console.log("====app======>"+app);
var proname = document.getElementById("title").innerHTML;
var protype = ws.flag;
console.log("====protype======>"+protype);
var url = app+'/order/orderManageAction!saveOrder.do?method=add&proname='+encodeURI(proname)+'&protype='+protype+'&random='+Math.random();
mui.ajax(url,{
recivepeople:recivepeople,
mobile:mobile,
address:address,
optname:optname,
price:price,
count:count,
io:io,
money:money,
remark:remark
},function(data) {
console.log("====data===>"+data);
if(data == 1){
mui.back();
mui.toast('保存成功!');
}else{
mui.toast('保存失败!');
}
},'text');
}
}
8***@qq.com (作者)
document.getElementById("addOrder").addEventListener('tap',function(){
addOrder();
});
2016-06-28 19:59