javascript - refresh a page after ajax form submit -
i using ajax submit form in popup , want refresh table after popup closed. have tried below code.
$('body').delegate('#add','click',function(){ var objpnt = $(this).parents('form'); name=objpnt.find("#name").val(); error=''; if(name === '') { error="<div class='alert alert-info'><span class='icon icon-color icon-alert'/>name field required</div>"; } $.post("ajax/add.php", $("form.addform").serialize(),function(html){ if(html === 'incorrect'){ objpnt.find("#add_err").css('display', 'inline', 'important'); objpnt.find("#add_err").html(error); } else { objpnt.find("#add_err").css('display', 'inline', 'important'); objpnt.find("#add_err").html("<div class='alert alert-info'><span class='icon icon-color icon-check'/>name added successfully.</div>"); } }); $.post('ajax/add.php',{ajax:'get_name_list'},function(data){ objpnt.replacewith(data); }); return false; });
but doesn't work.
$( document ).ajaxcomplete(function() { window.opener.location.reload(false); });
Comments
Post a Comment