0

this is the method

(reaaly this must to return a PartialView)

  [HttpPost]
        public ActionResult partial1()
        {
            return View();
        }

that does work when is called

as it

@using (
    Ajax.BeginForm("partial1", "Home",
    new AjaxOptions()
    {
        HttpMethod = "Post",
        InsertionMode = InsertionMode.Replace,
        Url = Url.Action("partial1", "Home"),
        UpdateTargetId = "divactualizar"
    }
    )
    )
{
<button type="button" id="btnmodal2">xxxxxx </button>

}

with the before code this does enter to the method and view o partial view is showed

with next code this does enter to the method and view is not showed WHY?

@section JavaScript
 {

      <script type="text/javascript">

          $(document).ready(
               function ()
               {

                  $("#btnmodal2").click(
                       function()
                       {

                           //$.post("@Url.Action("venta", "sale")");

                           $.ajax({
                              // async: true,
                               type: "POST",
                               dataType: "html",

                               url: "../Home/Partial1",
                               //data: "numero=" + v,
                             timeout: 4000,
                                                        });


                           @*type: 'POST',
                           url: '@Url.Content("~/ControllerName/ActionName")',
                           data: objectToPass,
                           success: function (data) {
                               $('#divid').innerHTML = data;
                           }*@

                      }

                      );
              }
              );

    </script>
  }  

enter image description here

tereško
  • 58,060
  • 25
  • 98
  • 150
angel
  • 4,474
  • 12
  • 57
  • 89

1 Answers1

0

You didn't write the success handler to insert returned data to target element.

Onur Gazioğlu
  • 501
  • 2
  • 12
  • What would I write? I want to show a View and a PartView – angel Jun 20 '15 at 22:42
  • Check these links: http://stackoverflow.com/questions/5316697/jquery-return-data-after-ajax-call-success http://stackoverflow.com/questions/555315/jquery-checking-success-of-ajax-post – Onur Gazioğlu Jun 20 '15 at 22:45
  • So rare, this works when I dont debbug, if I debug this does not appear, and this works ok if I dont debug it. – angel Jun 20 '15 at 23:12