1
我有一些标记,我在一个助手文件正在产生(这是位于根\ App_Code文件\ myHelper.cs目录)从CS辅助文件返回生成的标记:通过jQuery/AJAX
@helper GenerateMarkup(int id)
{
<div class="dude">
<a href="awesome.cshtml">Wow</a>
</div>
}
和,在我的结果页面中,我有一个应该去的地方。它应该去一个集装箱div
内:
<div class="ContainerDIV">
</div>
我做了一个小jQuery的尝试和发送ID(int
)的辅助文件中的GenerateMarkup(int id)
方法,它应该会返回生成的标记回jQuery函数,反过来,它应该在上面提到的ContainerDIV
内显示生成的标记。
这里是我的jQuery的东西(这是ContainerDIV
的DIV中(请原谅我的jQuery的苏茨基的烦躁,我很新的话):
<div id="ContainerDIV" class="Bordered">
<script>
$('.MoreInformationOnPosition').click(function() {
var elID = $(this).attr('id');
$.ajax({
type: "POST",
url: "JTS.cs/GenerateMarkup",
data: elID,
contentType: "application/html",
dataType: "html",
success: function (msg) {
// Replace the div's content with the page method's return.
$("#ContainerDIV").attr(msg.d);
}
});
});
</script>
</div>
它只是不工作我。我已经尝试了Visual Studio 2012的PageInspecter,并且找不到任何“问题”,但我确实知道我做了一些错误的事情,我相信这是一个独特的情况,这可能解释了为什么我没有找到任何关于网页关于这个。
我该如何做到这一点?我会很感激任何帮助。