var formData = new FormData();
formData.append('type', type);
formData.append('description', description);
formData.append('photo', photo);
var request = new XMLHttpRequest();
request.open('POST', '{{ path('my_webservice') }}');
request.send(formData);
How can I send my FormData
using $http
?
My main problem with the above code is that I don't know how to generate a callback when the response is received.
So, if I can do it in Angular I'm in more familiar territory.
Thanks
Edit
This seems to work asynchonously. Seems better than any of the Angular solutions suggested in terms of ease of implementation.
request.onload = function (e) {
if (request.readyState == 4 && request.status == 200) {
console.log(request.responseText);
}
};