0

I'm a frontend dev working on a ASP.NET project but need some sort of javascript call back for everytime an update panel fires.

Due to a package we are using, the method fired needs to be within a jQuery ready function so that we have access to all dom elements.

However, the following code does not get called when it is within jQuery ready:

function pageLoad(){ alert('page loaded!') }

But this does work when outside of jQuery.

Anything I can do to get this pageLoad method to call inside jQuery?

Heres what I thought would work:

jQuery(document).ready(function() {
    function pageLoad(sender, args) {
        console.log("test");
    }
});
Liam
  • 27,717
  • 28
  • 128
  • 190
Lovelock
  • 7,689
  • 19
  • 86
  • 186
  • Show your code attempt – Negi Rox Oct 26 '18 at 12:56
  • @NegiRox Just updated the question. – Lovelock Oct 26 '18 at 13:03
  • Wow, people still use update panels. – Liam Oct 26 '18 at 13:09
  • Possible duplicate of [Call a Javascript Function after UpdatePanel Postback Issue](https://stackoverflow.com/questions/5412120/call-a-javascript-function-after-updatepanel-postback-issue) – Liam Oct 26 '18 at 13:10
  • FYI this is a nightmare, the update panel marks the death of web forms, it was an MS hack to try and compete with the new MVC frameworks in 2006. It never worked well. Not long after MS abandoned the idea of Viewstate and went full MVC. The best advice I can give you is abandon the update panel ASAP and use actual AJAX calls. – Liam Oct 26 '18 at 13:12

0 Answers0