User1277400347 posted
Today I spent a bunch of time trying to find out why a view with this script couldn't find the DoThis() method.
<script type="text/javascript">
$(document).ready(
function () {
alert("In the function about to call main.DoThis()");
DoThis();
});
</script>
Step 1) I used a layout for this view that had this render statement for a bundle we created.
@Scripts.Render("~/bundles/main")
The function DoThis was in a file named main.js contained in that bundle.
Step 2) I attempted to debug using Chrome's F12 function setting breakpoint on the script above and it kept saying that the script wasn't found when DoThis() was executed.
Step 3) I looked in the scripts folder from Chrome and the script I wanted was there...#?@?$
Being relatively new to Javascript and how browsers load it.... I never once figured the reason it wasn't found was because there were errors in the Javascript itself. The only indicator I had was a small red mark at the end of the JS file that indicated
I hadn't included a "}"... Wow! Good lesson I guess.
If you have this symptom better take a close look at the Javascript.