This is a simplistic version of what I'm trying to do, but when you click on the link it redirects the page to the url + #, this is creating an additional navigation step when attempting to use the browser back button.
If I remove the href it doesn't work, if I change it to href='' then it refreshes the page every single time.
What is the proper way to handle this? I'm still attempting to learn jQuery / AJAX, so this may be a very basic question.
http://jsfiddle.net/bvp8xa5x/
HTML
<div id='updateMe'>Old Value</div>
<a href='#' id='test'>Test</a>
jQuery
$(function(){
$('#test').click(function(){
$.ajax({
type: "GET",
url: '',
success: function(data) {
$('#updateMe').html('New Value');
}
});
return false;
});
});
相关知识
a href=#1首版a a href=#1尾版a a href=#1A11版a
href=#|href=javascript:;|href=javascript:void(0)之用法区别,超级链接也能玩出花!
php login json,ajax + php + json = login
ajax实现在线投票,10分钟实现Ajax Vote投票、评分功能(Stars)
href=“JavaScript:;”是啥意思?
11个基于HTML/CSS/JS的情人节表白可爱小游戏、小动画【情人节主题征文】
javascript:void(0);用法及常见问题解析
Python爬虫基本流程梳理:构造请求头、发起请求、json格式数据解码转码、读写CSV文件——基于AJAX网页爬虫
兰州园艺学校网站网址主页
鲜花配送网上花店网址,51788鲜花
网址: AJAX href ='#'浏览网址 https://m.huajiangbk.com/newsview1293674.html
上一篇: Cmake编译文件若需要手动添加 |
下一篇: Focus on Flowers |