You must Sign In to post a response.
  • Category: ASP.Net MVC

    Ajax call with POST method to ActionMethod to return partial view

    My product is asp.net website which don't have any solution Or project file saved.

    I have started new model with MVC , I used View and Partial View.

    In some case I have to load partial view with i.e. ActionResult Ajax call , input is object so I have to call with POST method. Ajax call is successful doesn't through any error , in browsers developer tool I see response output it gives expected html. But problem is that it gives response in error part of Ajax call, not in sucess. What is wrong in this implementation ?

    E.g.


    $.ajax({
    url: 'URL',
    type: 'POST',
    data: JSON.stringify(Object),
    contentType: "application/json",
    success: function(result) {
    $('#div').html(result.responseText); //here I won't get any response
    },
    error: function(xhr) {
    $('#div').html(xhr.responseText); // here I get
    }
    });
  • #769569
    Can you please share Error from Developer Tool that you are getting?
    - Pavan Pareta

  • #769573
    Not Getting Any error , in xhr.response text it gives html of partial view, which I expected in success

  • #769579
    Hi,

    You can try below things:

    1.) Please make sure JSON returned in error function is in correct format
    2.) Try updating jQuery version , that you are using

    Thanks!

    Thanks!
    Anjali Bansal

    ~Give your best and lead the world


  • Sign In to post your comments