I am trying to update my page variables after an ajax request to an external page without reloading the current page. My current page is mysite.com/page?arrival=11/02/2019&departure=12/02/2019
On ajax success I update my url without refreshing the page with window.history.pushState but I can't manage to update my variables. The url changes to mysite.com/page?arrival=15/07/2019&departure=16/07/2019
but when I request from autocomplete $_GET['arrival']
it returns the original value "11/02/2019" I want to return the new value "15/07/2019" returned from ajax request
$('#unitrate').submit(function() {
{
$.ajax({
url: \"part-xml-room-ajax.php\",
type: \"GET\",
data: $('#unitrate').serialize(),
beforeSend: function() {
$(\"#xml-info-hide\").show();
$(\"#xml-info\").hide();
},
success: function(result) {
$('#xml-info').html(result);
window.history.pushState(\"Details\", \"Title\", ('?&'+$('#unitrate').serialize()));
$(\"#xml-info-hide\").hide();
$(\"#xml-info\").show();
}
});
}
return false;
});