Uploading file using ajax throws Uncaught TypeError: Illegal invocation

Jquery version used is jquery 1.7.1 on clicking uplod button it shows error as Uncaught TypeError: Illegal invocation

$('#upload').on('click',function(){
    var form = new FormData();
    form.append('fw_file',$("#fw_file")[0].files[0]);
    $.ajax({
        url: base_url+'fieldwork/savefieldwork',
        cache: false,
        contentType: false,
        processData: false,
        dataType: 'json',
        type: 'POST', 
        data: form,
        success: function(data){

        }
    });
<form action="" method="post" accept-charset="utf-8" name="fieldworkform" id="fieldworkform" enctype="multipart/form-data">
<input type="file" name="fw_file" id="fw_file">
<input type="button" value="Upload" name="fileupload" id="upload">
</form>

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.