【发布时间】:2015-04-15 17:24:16
【问题描述】:
我将使用owl carosel。在硬编码的 div 的工作中。现在我想通过 ajax 函数获得这种类型。我将尝试以多种方式做到这一点,但没有成功。
我的 Webmethod 它返回图像路径和标题值。
<div id="owl-demo">
<div class="item"><a class="item link"><img src="/Content/images/sdfdfd.png" alt="Owl Image"></a><p><center>CAPTION</center></p></div>
<div class="item"><a class="item link"><img src="/Content/images/tyty.png" alt="Owl Image"></a><p><center>CAPTION</center></p></div>
</div>
我的 Ajax 函数(而不是硬编码的值)
function GetAllImages()
{
$.ajax({
type: "POST",
url: "/Dest/GetAllImages",
success: function (msg) {
debugger;
if (msg._allImg.length > 0) {
$.each(msg._allImg, function (index, item) {
//In here i need to construct that above pattern
//My Webmethod it returns the Image Path & Caption values.
var html = $("<div>").html();
var html2 = $("<img src").html();
$('#owl-demo').append(html);
});
}
else {
}
}
});
}
【问题讨论】:
标签: c# jquery asp.net ajax json