Update URL on AJAX call?

前端 未结 5 902
误落风尘
误落风尘 2020-12-25 13:50

Right now the biggest issue I\'m having with using AJAX is the fact that if I use AJAX on a page, go to another page, then use the browser\'s back button to go back anything

5条回答
  •  粉色の甜心
    2020-12-25 14:29

    After making AJAX call, we can update the Client URL using history.pushState. Please find the below syntax and example

    Syntax: history.pushState(obj, obj.Title, obj.Url);

    Example:

    var url = "http://example.com/mypage/" + "newParameter=newValue"
    history.pushState(undefined, '', url);
    

提交回复
热议问题