php - Uploading a form having an image file without refreshing the page -
i want post form php script process form , add data database send uploaded form event handler of jquery. form contains image file in it. problem not getting response php script event handler.
$('#form').on('submit',function(e){ e.preventdefault(); $("#output").html('loading...'); $("#form").ajaxform({ target: '#output' }; }); <form action="post.php" method="post" enctype="multipart/form-data" id="form"> <textarea class="post" name="text" style="height:10; font-size:16px;"> </textarea> <input type="file" name="pic" class="post_image"/> <input type="submit" name="subp" id="postbutton" value="post" class="post_button" /> </form> <div id="output"></div> //post.php <?php echo "hi"; ?>
the problem #output div showing "loading..." instead should show "hi" returned php script.
you've use iframe kind of functionality
<form enctype="multipart/form-data" method="post" action="post.php" target="imageuploaderframe"> <label>upload image: </label><input type="file" name="profile_image" id="uploadprofileimage"/> </form> <iframe id="imageuploaderframe" name="imageuploaderframe" style="display:none"></iframe>
Comments
Post a Comment