Does not return value pro javascript

Asked

Viewed 230 times

3

I have a problem that the value that comes from my controller does not return to javascript.

I’ll explain what happens:

I send requests via ajax to my controller and it is waiting for the return of values, while there is no return value my ajax is waiting, then when there is the return value it displays in my modal, until then if I’m on the page I open the modal works cool without any problem, but if I refresh the screen (F5) or change the page (view) the value that is waiting in the controller does not arrive but in ajax. But in the controller it processes all the information as it is to be displayed in the modal.


ajax

$.ajax({
        type: 'post',
        url: urlW,
        success: function (data) {

}

controller

AnalistaBean a = new AnalistaBean();
a = atendeBussines.ReceiveCTI((Socket)Session["ConexaoCTI"]);
return Json(new { r = a });

But he only stops sending the request to ajax when I give F5 or change page

1 answer

1

Just add a Hidden field in your view that receives the value of your request from the controller and it will remain persisted. To pick up and resubmit the request you just pick up with javascript o value of that input.

Browser other questions tagged

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