jquery - Why is this form not submitting inside the target iframe? -
i've created form targets iframe submit image. absolutely had working previously, whole page submits, instead of iframe. i'm @ total loss.
html:
<form id="upload-form" name="upload-form" class="" action="/handle/upload" method="post" enctype="multipart/form-data"> <div class="fileinput-wrap"> <label for="fileinput">image input</label> <input type="file" name="file" id="fileinput" /> </div> <input type="submit" id="submitter" name="submitter" /> </form>
js:
$("#fileinput").on('change', function () { var $iframe = $("<iframe />").attr({ id: 'frame_uploader', name: 'frame_uploader' }); var $img = $("<img />"); var imageurl = ""; $("#upload-form").prepend($img).append($iframe) .attr('target', 'frame_uploader') .trigger('submit'); $iframe.load(function () { var imageurl = $iframe.contents().find("body").text(); $img.attr('src', imageurl); }); });
http://jsfiddle.net/nvp9k/
i read somewhere iframe names reserved. changing name of iframe has fixed problem.
jquery forms iframe upload
No comments:
Post a Comment