jeudi 26 mars 2015

Modify FormData with jQuery

I am trying to modify the "likes" of a xml file. How do I do that?


What I'm trying now:



var likes = +1;
formData.append("likes", likes);

var xhr = new XMLHttpRequest();
xhr.addEventListener("loadstart", showLoading, false);
var url = "linkishere";
xhr.open('POST', url, true);
xhr.onload = function (e) {
var response = $.parseJSON(e.target.response);
if (response.success == true) {
console.log('success: '+response.success);
hideLoading();
showThankyou();
console.log('Het stemmen is gelukt');
}else {
alert(response.error.message);
console.log(response.error.message);
console.log(agreeTermsAndConditions);
console.log('Er ging iets fout.');
}
};
xhr.send(formData); // multipart/form-data
}


Hope someone can help me with this. Do I use append for this? Sorry I'm kinda new to this.


Aucun commentaire:

Enregistrer un commentaire