Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 flexslider 2动态添加新图像以滑入旋转木马_Asp.net Mvc 3_Carousel_Flexslider - Fatal编程技术网

Asp.net mvc 3 flexslider 2动态添加新图像以滑入旋转木马

Asp.net mvc 3 flexslider 2动态添加新图像以滑入旋转木马,asp.net-mvc-3,carousel,flexslider,Asp.net Mvc 3,Carousel,Flexslider,我有一页有一些图片的幻灯片。我现在需要的是添加一个新的图像到幻灯片传送带上,而无需回发。我的密码是 弹性滑块 $(window).load(function() { $('.flexslider').flexslider({ animation: "slide", controlsContainer: ".flex-container", start: function(slider) { $('.total-slides').text(slider.count);

我有一页有一些图片的幻灯片。我现在需要的是添加一个新的图像到幻灯片传送带上,而无需回发。我的密码是

弹性滑块

  $(window).load(function() {
$('.flexslider').flexslider({
  animation: "slide",
  controlsContainer: ".flex-container",
  start: function(slider) {
    $('.total-slides').text(slider.count);
  },
  after: function(slider) {
    $('.current-slide').text(slider.currentSlide);
  }
});
ajax代码

  $.ajax({
    url: '@Url.Action("LoadCarrusel","picture",new { @id =  @Model.Propertyid })',
    type: 'GET',
    dataType: 'json',
    success: function (data) {
        var flexslider = document.getElementById("flexslider");
       // process the data coming back
        $.each(data, function (index, item) {

            var link = "../../Content/Uploaded-img/" + item;
            var imag = document.createElement("img");
            imag.setAttribute("src", link);

            var newpicture = document.createElement("li");

            var newpictureItem = document.createTextNode(imag);
            newpicture.appendChild(imag);           
            flexslider.appendChild(newpicture);              

        });
    },

    error: function (xhr, ajaxOptions, thrownError) {
        alert(xhr.status);
        alert(thrownError);
    }

});
传递数据json的控制器是

 public ActionResult LoadCarrusel(long id)
    {
        var routes = from s in db.Picture
                     where s.IdProp == id
                     select s.Location;


        return Json(routes, JsonRequestBehavior.AllowGet);
    }