单击标记链接时会触发以下功能,但我希望在单击后2秒重新加载。我怎么能做到这一点?
<script type="text/javascript">
jQuery(document).ready(function($) {
$("a.flag").on("click",function() {
var lang_prefix = $(this).attr("class").split(" ")[2];
window.location.href = window.location.href.split("?")[0] + "?lang=" + lang_prefix;
});
});
</script>
答案 0 :(得分:2)
jQuery(document).ready(function($) {
$("a.flag").on("click",function() {
var lang_prefix = $(this).attr("class").split(" ")[2];
setTimeout(function(){
window.location.href = window.location.href.split("?")[0] + "?lang=" + lang_prefix;
}, 2000);
});
});