JavaScript的不工作,心不是越来越参数? [英] javascript doesnt work, isnt getting parameters?
本文介绍了JavaScript的不工作,心不是越来越参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
人知道为什么心不是今天的工作2回答,组合。我只是试图让传递警报显示参数,其他一切作品所以忽略URL操作等
anyone know why this isnt working, combination of 2 answers today. im just trying to get the parameter passed to show up in alert, everything else works so ignore the url action etc
$('#changetopicss').click(function () {
$('#loadingAjaxs').show();
$('#flubestext').hide();
var link = '@Url.Action("Detail", "Topics", new { @id = 304, @name = "newest", @forum = "all", @page = 0})';
var dataid = $(this).data(id);
// link = link.replace("-1", $(this).data(id));
// link = link.replace("-2", $(this).data(shortname));
window.alert(dataid);
$('#contentwrap').load(link, function () {
$('#loadingAjaxs').hide();
$('#flubestext').show();
window.history.pushState(null, 'title', '/topics');
});
});
</script>
<a id="changetopicss" data-id='@following.Id' data-shortname='@following.ShortName'>@following.Title</a>
一切工作,现在正试图调试为什么我不能传递数据ID来作为window.alert它不是在url.action工作
everything else works, now trying to debug why i cant pass the data-id to window.alert as it wasnt working in url.action
推荐答案
应
var dataid = $(this).data('id');
有一个带引号的字符串,而不仅仅是一个标识符。
A quoted string, not just an identifier.
这篇关于JavaScript的不工作,心不是越来越参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文