Search code examples
jqueryajaxfile-uploadjquery-forms-plugin

Uploading an Image using jQuery Ajax plugin not working in IE


I'm using Malsup's jquery form plugin

I have this code.

$(document).ready(function() { 
        jQuery("input[name=file]").change(function(e){
            if( browserType == "MSIE" ){
                jQuery("#start_campaign").ajaxForm({
                    target: '.imgPreview',  
                    url: host+"/forms/campaign-image-upload.php?action=ajaxUploadImage",
                    beforeSend: function() {
                        console.log(2);
                    },
                    success: function(responseText,statusText,xhr,$form) {
                        alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
                        '\n\nThe output div should have already been updated with the responseText.');
                    }
                }).submit();
            } else {
                readURL(this);
            }   
        });
    });

It's running on the beforeSend function but after that it has this kind of error:

SCRIPT3: Member not found.
 
jquery.form.js, line 349 character 5
LOG: [jquery.form] state = complete 

This is line 349: enter image description here

What's the problem with this code? I've been searching on the internet and found no answer.

Your help would be greatly appreciated and rewarded!

Thanks!


Solution

  • I answered this one by looking on this url: http://peroijanet.wordpress.com/2011/06/22/script3-member-not-found/

    It seems the error is about having multiple submit buttons on your page with the same name="submit" Make sure you only have one submit button <input type="submit" name="submit" value="Submit" />

    Gosh this saved my Day! :D