javascript - How to reload current page with variable from ajax response? -
i'm using ajax form send post data php file. , want reload current page variable response php. need update url in address bar after success response. code:
type: 'post', success: function(data){ var data; if(data && data != 'error') { window.history.pushstate("string", "title", "article.php?do=$_get[do]&token='+data+'"); }else{ $('#savestts').html('error'); }
my response variable php time stamp 1433428606
. need number reload page full url : www.test.com/admin/article.php?do=edit&token=1433428606
. tried reload data
instead of timestamp server. please advice.
this state push can done in chrome, safari, ff4+, , ie10+.
the way you're doing looks right, having troubles?
window.history.pushstate("object or string", "title", "/new-url");
there's response on topic here: updating address bar new url without hash or reloading page
Comments
Post a Comment