我正在尝试以下方面:
当用户单击链接时,我想通过ajax更新数据库中特定表的特定列.但我仍然希望将用户重定向到href="<url>"链接.
我尝试了jQuery return false;但是ajax不起作用.
我试过return false;但是页面显然没有重定向到我想要的网址.
在此先感谢您的帮助.
Roc*_*mat 11
做你的AJAX调用,然后document.location完成设置.
$('a').click(function(e){
var href = this.href; // get href from link
e.preventDefault(); // don't follow the link
$.ajax({
url: '/path/to/site',
data: {some: data},
success: function(){
document.location = href; // redirect browser to link
}
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10213 次 |
| 最近记录: |