Jquery .submit() event to firing

2020-05-08 07:00发布

问题:

HTML

<form action="includes/photos.php" id="joinPhotoUploadForm" enctype="multipart/form-data">
  <input type="file" name="file" id="file"><br>
</form>

Jquery

$('div#photoCropContainer').click(function() {
  $('input#file').trigger('click');
});

And

$(document).on('change','input#file', function() {
    alert('ready to upload');
    $('form#joinPhotoUploadForm').submit();
});

When someone clicks the Div@photoCropContainer it trigers a click on the file input, shows the popup and sends the file. This works on FF & Chrome.

On IE9 however I always get the popup but no other reply...

Can anyone give me any advise?

thanks

回答1:

As I can see in IE9 console "access denied" on form submit line, thats why nothing works. Look at this question ie javascript form submit with file input