页面加载后如何存储javascript函数的值 [英] How i store value of javascript function after pageload

查看:64
本文介绍了页面加载后如何存储javascript函数的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在asp.net中使用google map api codin..

页面加载时..地图显示我当前所在的位置..

现在,当我单击更改位置按钮时.位置已更改.和地图显示新位置,但问题是当我按f5键时,新位置更改为旧位置.或上一个.

告诉我我如何存储新位置.在页面加载后进行映射

i am using google map api codin in asp.net..

when page is load.. map display current location where i am..

now when i click on change location button.. the location is change. and map show new location but the problem is when i press f5 the new location is changed to old location. or previous one.

tell me how i store new location. to map after page load

推荐答案

发送Ajax Request到服务器,并将该位置保存在cookie或会话中.当我从上面提到的位置读取页面重新加载时.
send Ajax Request to server and save that location in cookie or in session. when page reload read from above location I mentioned.


我不确定您是如何实现的,但是查看Google Maps的实现方式,它完全基于AJAX.如果您仔细地看到,则该Web URL是静态的,并且当您尝试转到新位置时没有任何变化.因此,F5完全按照URL生成旧版本.

可能的解决方案,保持AJAX更改历史记录.相应地处理F5.
I am not sure how you implemented it but looking at how Google Maps are implemented, it''s totally AJAX based. If you see carefylly, the web URL is static and there is not change when you try to go to a new location. Thus F5 leads to old one exactly as per URL.

Possible resolution, maintain AJAX changes history. Handle the F5 accordingly.


这篇关于页面加载后如何存储javascript函数的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆