I am creating a website that has a Career Page, to resume the input file HTML control. Using JQuery to post the values of the form on the AXX page, everything works fine except for uploading the file. How can I use jQuery to post each field (including files) in ajax request? The example I'm seeing in Google is managing to only upload files, with no other fields. It does not have to upload my JQuery, ASPX files.
& lt; Script type = "text / javascript" & gt; $ (Document) .ready (function (e) {// file variable var file; // add event $ ('# restart'). ('Change', upload ready); // hold files and give them our Set Change Variable Function (Event) {files = event.target.files;} $ ("#submit_btn"). Click (function () {var fileData = new formData (); $ .each (files, functions ( Key, value) {FileData.append (key, value);}) var formMessage = tinyMCE.get ('message'). GetContent (); var formname = $ ('.content-container #name'). Val ( ); Var formPhone = $ ('Contact-container #phone'). Val (); var formEmail = $ ('contact-container #email') Val (); var formApplyFor = $ ('contact-container #applyforfor') .value (); // Get some values from the elements on the page: var a = $ .ajax ({method: "POST", Url: "mail / test.aspx", process data: wrong, content type: incorrect, data one: {form: 'carrier', name: formname, phone: formphone, email: form email, application for: formapplefor Start again: File data, wrapper sheet: window.botto (unsecope (sign message)}, success: work (data) {alert ('success'); }, Error: function (data) {warning ('error'); }}) Don (function (msg) {alert ('done');}); // Ajax end warning (A); }); // Submit Button End}}; // Document Ready End & lt; / Script & gt;
This is probably because you do not have it differently but behave as a form object (
I did a quick test to demonstrate it uses ASP.NET MVC:
HTML and Javascript:
No comments:
Post a Comment