8***@qq.com
8***@qq.com
  • 发布:2016-06-27 22:16
  • 更新:2016-07-15 10:29
  • 阅读:1269

ajax请求

分类:MUI

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');  
        }  
    }
2016-06-27 22:16 负责人:无 分享
已邀请:
BoredApe

BoredApe - 有问题就会有答案。

addOrder() 方法在哪里调的?

  • 8***@qq.com (作者)

    document.getElementById("addOrder").addEventListener('tap',function(){

    addOrder();

    });

    2016-06-28 19:59

8***@qq.com

8***@qq.com (作者)

问题解决了,是我写错了,应该写mui.post而不是mui.ajax

王琦888

王琦888 - 1234123

粗心。。。

尤浪

尤浪 - 哈啊哈哈

受教

尤浪

尤浪 - 哈啊哈哈

谢谢

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