I need to upload files without refreshing the page using jQuery.
I found the code using jquery.min.js and jquery.form.js in an old jQuery, but I need it to be done using the latest jQuery. Please tell me what the equivalent code using the latest jQuery would be for this:
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/jquery.form.js"></script>
<script type="text/javascript" >
$(document).ready(function() {
$('#photoimg').change(function(){
$("#preview").html('');
$("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
$("#imageform").ajaxForm({
target: '#preview'
}).submit();
});
});
</script>
<form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'>
Upload your image <input type="file" name="photoimg" id="photoimg" />
</form>
<div id='preview'></div>
Actually i was using old version of the jquery. Now i used the latest version of jquery and its working file. Thanks for all for support and help.