0

I need to post a form on C# server-side using Javascript. I am using the following code

    $("#Form").submit(function () {

        $.ajax({
            url: 'NewRequest',
            data: $(this).serializeArray(),
            type: 'post',
            success: function (data, status, xhr) { alert("Dinesh"); },
            dataType:'json',
        });return false;
});

I have an attachement with other text fields in HTML

<form role="form" id="Form" method="post" enctype="multipart/form-data"  > <input type="file" name="Attachment" id="Attachment" multiple="multiple" /></div> </form>

All the fields are being picked up while debugging but no the attachment one. Please help

  • 1
    possible duplicate of [Sending multipart/formdata with jQuery.ajax](http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax) – Beginner Sep 27 '15 at 12:49
  • add contentType: false, processData: false to your ajax request – Hasta Tamang Sep 27 '15 at 12:55

0 Answers0