Jquery 根据数据库中存储的路径从文件夹中检索图像
我想通过jquery显示列表中文件夹中的图像,我正在使用MVC4.0。映像路径由存储过程进行追溯。Jquery 根据数据库中存储的路径从文件夹中检索图像,jquery,image,Jquery,Image,我想通过jquery显示列表中文件夹中的图像,我正在使用MVC4.0。映像路径由存储过程进行追溯。//MVC操作,它以Json数组的形式返回路径列表 // MVC action which returns a list of paths as Json array public ActionResult GetImages() { IEnumerable<string> imagePaths = GetImagePathsFromStoredProcedure();
//MVC操作,它以Json数组的形式返回路径列表
// MVC action which returns a list of paths as Json array
public ActionResult GetImages()
{
IEnumerable<string> imagePaths = GetImagePathsFromStoredProcedure();
return Json(imagePaths, JsonRequestBehavior.AllowGet);
}
function getImagePathds() {
$.get("/Home/GetImages", function (data, status) {
if (status === "success") {
for (var i = 0, len = data.length; i < len; i++) {
var imagePath = data[i];
$("<img alt='' />").attr("src", imagePath).appendTo($("body"));
}
}
});
};
公共操作结果GetImages()
{
IEnumerable ImagePath=GetImagePathsFromStoredProcess();
返回Json(ImagePath,JsonRequestBehavior.AllowGet);
}
函数getImagePathds(){
$.get(“/Home/GetImages”,函数(数据、状态){
如果(状态==“成功”){
对于(变量i=0,len=data.length;i $(“我要写些什么?”??