1

I have a c# MVC page (not that I think that matters to this question). When the page is loaded, it immediately makes an ajax call to a service that prepares a lot of information, and then loads it into the page. (whilst displaying a Loading Data Modal).

    <script type="text/javascript">
    $(document).ready(function () {
        $('#loadingWebServiceData').modal({
            backdrop: 'static',
            keyboard: false,
            show: true
        });
        $("#Summary").load("/Summary/GetAllSummaries",
       function () {
           $('#loadingWebServiceData').modal('hide');
       });
    });
</script>

This all works when the page is first hit. However, if I then select a record, and make some changes to it on a different view, then save the changes, the last code in my controller is;

return View("Index");

This returns me back to my original page, however the data hasn't been updated. Debugger and breakpoints show that when I return to the index page the document.ready doesn't fire.

So either there is something subtly wrong in what I am doing, or I have misunderstood document.ready.

freedomn-m
  • 27,664
  • 8
  • 35
  • 57
Matt
  • 1,596
  • 2
  • 18
  • 32
  • Maybe look at this SO question: http://stackoverflow.com/questions/9586903/document-ready-is-not-working-after-postback. Looks to be a similar issue. – Ingenioushax Mar 24 '17 at 15:12
  • Why didn't I see that. Its to do with Webforms not MVC, but I am sure that I can get the solution from that, many thanks! – Matt Mar 24 '17 at 15:27

0 Answers0