ajax返回数据不跳success

<form action="" onsubmit="post_data();return false;" id="formT" method="post" class="form-T">
 
form标签内加 onsubmit="post_data();return false;"
 
function post_data(){
$.ajax({
                url: "",
                type: "POST",
                data: form,
                dataType: "json",             
                success: function (res) {
                alert(res.msg);
                },
                error:function(){
                    console.log("请求失败")
                },
                timeout:2000,
                });
                return false;
            })
 }
函数采用function post_data()写法
$.ajax添加return false;
 

posted on 2020-03-26 16:05  网瘾秋千  阅读(247)  评论(0编辑  收藏  举报

导航