​​formdata,ajax提交数据​​



var data = document.getElementById("#dataForm");

var formData = new FormData(data);

var account = $(".account").val();

var phone = $(".phone").val();

var pass = $(".surepass").val();

var community = $(".cellname").val();

var validate = $(".validate").val();

formData.append("account",account);

formData.append("phone",phone);

formData.append("pass",pass);

formData.append("community",community);

formData.append("validate",validate);

$.ajax({

url:url+'/register',

data: formData,

type: 'POST',

dataType: 'JSON',

headers: {

"token": TD.getSession(), //TOKEN

},

processData: false,

contentType: false,

success:function(response){

if(response.success==true){

mui.alert(response.message);

}else{

mui.alert(response.message);

}

},

error:function(response){

mui.alert(response.message);

}

});