I would like to add a small bit of javascript to an existing Asp.Net MVC application. I have not been able to get the javascript to work, and so I tried creating a simple page to showcase the problem.
The code works when you just open it in a browser, however if the webpage provided by my application it does not work - the onsubmit function is never called.
The actual source code is identical in both situation, the only difference is in the success case I open the html file directly. In the failure case it is returned by my app.
I think there must be some kind of communication between the web app and the browser that disables javascript, but I don't know what it would be.
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
<script>
function dontSubmit() {
alert("You pressed submit");
return false;
}
</script>
<form action="http://www.google.com/" method="POST" onsubmit="return dontSubmit();">
<input type="submit" value="Submit">
</form>
</body>
</html>
_Laout.cshtmlpage?