$("#@ViewBag.PageGroupID").append(data);
现在ViewBag.PageGroupID
在运行时返回 div 的 id。如果我想在 div 中附加数据(我将在运行时获得的 id)怎么办。我该如何实现呢?
$('#btnPageElementClick').click(function () {
var flag = false;
var b;
$.ajax({ type: 'GET', url: '/ScriptedTestCase/pageElementPV/' + $('#PageElements').val(), data: null,
success: function (data)
{
$("#@ViewBag.PageGroupID").append(data); //where divID is the id of the div you append the data.
}
});
return false;
});