Load HTML into Div via Ajax

Asked

Viewed 647 times

0

I would like to take the answer from ajax, and press div...

If I load the div, passing the url works 100%

var detalhamentoDiv = $("#detalhamentoDiv");
detalhamentoDiv.load('/Exemplo/Controller/Teste');
$('#detalhamentoDiv').modal('show')

But the problem I want to load the div with ajax’s replay.

$.ajax({
    url: "/Exemplo/Controller/ConfirmarDados",
    type: "post",
    data: postForm, //dados
    success: function (response) {
        var detalhamentoDiv = $("#detalhamentoDiv");
        //como carregar a div com a response??
        //detalhamentoDiv.??
    },
    error: function (jqXHR, textStatus, errorThrown) {
        console.log(textStatus, errorThrown);
    }
});

Code C#

 public ActionResult ConfirmarDados()
 {
    var model = ...;
    return PartialView("_ModalDialog", model)
 }

Thank you..

1 answer

1


Do so:

...
success: function (response) {
    $("#detalhamentoDiv").html(response);
}
...
  • It worked perfectly, thank you!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.