خرید بک لینک

Vote count: 0

I have a form that uploads image file then updates image value in database successfully via ajax. However when I try to .load the 'profile_pic.php' which echos the above image tag, the image is not updated on the webpage. I don't want to refresh page. The echo statement from the php is outputting the same src path which already exists in the dom. I need it to remain this way. Can anyone recommend a better approach?

<div class="actor-profile-pic">
    <img id="profilepic" src="uploads/jgunzblazin">                     
</div>

<form id="file-form" name="uploadpic" class="infoHeader" enctype="multipart/form-data">
    <input type="hidden" name="MAX_FILE_SIZE" value="5242888" />
    <input type="file" name="image" />
    <input type="submit" name="uploadpic" value="Submit" />
</form>

$(document).ready(function(){
    $("#file-form").on('submit',(function(e) {
        e.preventDefault();
        $.ajax({
            url: "actor_profile.php",
            type: "POST",
            data:  new FormData(this),
            contentType: false,
            cache: false,
            processData:false,
            success: function(data){
                $(".actor-profile-pic").load("../profile_pic.php #profilepic"); 
            }           
   });
}));

});

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 11 مرداد 1395 ساعت: 7:02

صفحه بندی