jquery - Page is getting refreshed when window opens for file upload -
i have jsp page have fields uploading images.i using jquery.fileupload.js uploading images on jsp page. when clicking on button upload image, window browsing image getting opened in background page gets refreshed.
please tell me why getting refreshed.
following html code html button.
<button role="button" value="upload" onclick="$(this).next().click()">upload</button> <input id="image_125_625" class="image-file" type="file" name="file" style="display: none;" data-url="/admin/product/image/upload?imagesize=image_125&imageid=625" accept="image/*" />
and following javascript code file uploading
$(".image-file") .each(function() { $(this) .fileupload( { datatype : "json", acceptfiletypes : /(\.|\/)(jpe?g)$/i, done : function(e,data) { var src = "${pagecontext.request.contextpath}/admin/image/load/" + data.result.link; src += (((src.indexof("?") !== -1) ? "&":"?")+randomnumber(10000)); $("#img_"+ e.target.id).attr("src",src); } }); });
Comments
Post a Comment