这是我想在用户单击链接时执行的事件的列表。发布并等待返回onclick事件
- 用户单击搜索结果中的链接。
- 会话在服务器上使用jQuery post进行更新。
- 当会话更新时,搜索将保存到localStorage。
- 完成后,请点击被点击的链接。
下面的代码:
// Manually save the lastest search result and update session at server
$('a.e').click(function (event) {
event.preventDefault();
if (('localStorage' in window) && window['localStorage'] !== null) {
$.post("Home/UpdateSession/", $("form").serialize());
var form = $("#myTable").html();
localStorage.setItem('myTable', form);
form = null;
}
$.get($(this).attr('href'));
});
我得到一个错误说,本次会议没有更新的服务器,当我点击此链接。如果我在帖子中调用的动作中放置一个断点,它不会在那里打破。是否可以按照此顺序执行这些步骤,或者是在帖子之前调用的点击事件?
你想要访问什么页面?首页/ UpdateSession /指数。???或Home/UpdateSession。 –
我试图在帖子中访问ActionResult'UpdateSession',然后获取被点击的链接的href。 – Niklas
所以这是你正在使用的.NET?此外,尝试Home/UpdateSession的网址,而不是主页/ UpdateSession/ –