I have div that renders image gallery on my page
        <div id="gallery">       
    @{
        Html.RenderAction("UserGallery");
     }
I have this function which runs on the completion of a successful upload of a new image
        function filesUploadOnSuccess(e) {
            function updateCart() {
                //var tdata = $(frm).serialize(); 
                // or your data in the format that will be used ??
                $.ajax({
                    type: "GET",
                    //data: tdata,
                    url : '@Url.Action("UserGallery")',
                    dataType: "json",
                    success: function (result) { success(result); }
                });
            };
        }
        function success(result) {
            $("#gallery").html(result);
        }
the problem is that the gallery div doesnt get updated.
dateType should be "html", not "json", if your action returns a PartialViewResult:
public ActionResult UserGallery()
{
  // do something
  return PartialView();    
}
and
 $.ajax({
    url : '@Url.Action("UserGallery")',
    dataType: "html",
    success: function (result) { success(result); }
 });
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With