I have a Vue instance in which I get values from a form to send via ajax, I would like to clear the data saved by the v-models at once after sending, is it possible?
new Vue({
el: '#app',
data: {
campo1: "",
},
methods:{
saveForm:function() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
//document.getElementById("demo").innerHTML = this.responseText;
alert(this.responseText);
}
};
xhttp.open("POST", "helpers/get_campo.php", true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send(
"campo1="+this.campo1
);
this.campo1 = "";
}
}