Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where would the on-load handler be in MVC?

I'm looking to add code to my Onload handler but am unsure where it would be in an MVC application?

 // You may want to place these lines inside an onload handler
 CFInstall.check({
     mode: "overlay",
     destination: "http://localhost:1414/"
 });
});

The code above needs to be placed in the onload handler.

like image 214
Pomster Avatar asked Jan 27 '26 03:01

Pomster


1 Answers

If I understand you correctly, you just need this expression below, if you are using jQuery:

<script>
    $(document).ready(function() {
        // Handler for .ready() called. Put your logic here.
    });
</script>

or this one, without usage of jQuery:

<script>
    window.onload = function(){
        // Put your logic here.        
    } 
</script>

to be included on your view.cshtml.

like image 156
jwaliszko Avatar answered Jan 29 '26 11:01

jwaliszko