$('#image_image').change(function() { form=document.getElementById('new_image') data=new FormData(form) var xhr = new XMLHttpRequest(); xhr.open("POST", "images"); xhr.send(data); });