简体   繁体   English

使用AJAX功能更新URL

[英]updating URL with AJAX function

Is it possible to make an AJAX function that can pass a variable to the URL without refreshing the page? 是否可以使AJAX函数可以在不刷新页面的情况下将变量传递给URL?

You see I have a graph being rendered to my page using the Highcharts API. 您会看到我有一个使用Highcharts API渲染到我的页面的图形。 It knows which graph to render by checking what variable is in the URL. 它通过检查URL中的变量知道要渲染的图形。

So the idea is I can make buttons on the page that will update the URL seamlessly and therefore update the graph seamlessly. 因此,我的想法是我可以在页面上创建按钮,以无缝更新URL,从而无缝更新图形。 No refreshing required. 无需刷新。

Using HTML5 History-API. 使用HTML5历史记录API。 Push a new state into the history. 将新状态推向历史。 Have a look at the demos at history.js ( https://github.com/browserstate/history.js/ ) 看一下history.js上的演示( https://github.com/browserstate/history.js/

EDIT: for jquery you can use jQuery Address: http://www.asual.com/jquery/address/ 编辑:对于jquery,您可以使用jQuery地址: http : //www.asual.com/jquery/address/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM