What is the best way to replace a specific Web Api method for MVC architecture?

Asked

Viewed 120 times

1

How best to replace the following method Sys.WebForms.PageRequestManager.getInstance().add_endRequest() Webform for MVC Structure?

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);


  <script type="text/javascript">
// Esta função será executada:
// - Ao finalizar o evento do botão
// - Após o applet chamar a função que finaliza a acao;
// Por causa do suporte ao AJAX adicionado.
function EndRequestHandler() {
    if (document.getElementById("chamarFuncao").value == "true") {
        funcao();
        document.getElementById("chamarFuncao").value = "false";
    }
}

// Função executado pela tag <body ... onload="load()">
function load() {
//esse é o trecho que estou tentando arrumar
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}

// Quando clicar no botão da acão, irá limbar os campos.
function limparTextBoxLog() {
    document.getElementById("TextBox_toLog").value = "";
    document.getElementById("TextBox1_finaliza_toLog").value = "";
}


</script>

https://stackoverflow.com/questions/18157483/asp-net-mvc-4-action-on-ajax-request

  • 1

    Friend, what do you want to do? Get all ajax requests from your system?

  • This method is an example of using an applet that is webform, I am trying to pass to my project that is in mvc and this method is generating an error, I believe it is because it is specific to webform, I need to know what is the method that can replace itlo, the applet is running in parts and "I believe" that this is the Sys.WebForms.Pagerequestmanager.getInstance() method. add_endRequest() that does not leave it round.

  • 1

    Swap the two lines that have this Pagerequest.... for this line "$( Document ).ajaxStop(Endrequesthandler);"

  • Managed to make?

  • yes, the error disappeared and the applet worked, both with ajaxStop,ajaxSend,ajaxComplete left the code without error and made the applet method work, bringing data from the client(client side).

  • Give me a tip then, just to help me with 1 point.

Show 1 more comment
No answers

Browser other questions tagged

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