0

I am using Jquery to create/assign individual input fields(including Files upload) to text/div elements. No < form > tag is involved.

$.ajax function, was my first trial but it can not send files. My understanding is, once the data arrives in a file on back-end, another server side script could go ahead and feed it into a form_format or directly uses the data for further processing. What is the best approach for communicating between back end and front end in this case?

$.ajax({
type: "POST",
url: "http://upload.website.com/echo.cgi",
data: { name: $('#Name').val(), phone: $('#Phone').val() }
}).done(function(msg) {
alert("Success!"+msg);
});
  • Is this a duplicate of: http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery?rq=1 – DevlshOne Jul 12 '13 at 04:30

1 Answers1

0

you can use formData object and send files using ajax. Please refer to https://developer.mozilla.org/en-US/docs/Web/Guide/Using_FormData_Objects for usege with or without jquery.

The Code
  • 1,249
  • 1
  • 7
  • 11