troubleshooting Question

ASP.net MVC 3 Alert messages cause error message on page. (Unable to display alerts)

Avatar of Steve7423
Steve7423Flag for Canada asked on
ASP.NET
10 Comments1 Solution1415 ViewsLast Modified:
I have a page that first checks to see if the message property contains a value, if it does then display it.  The problem is that when I publish the site to the web server, the page displays an error; see attached.  If I comment out the alert(msg) the page displays without an error.  If I uncomment, it errors out.  Not knowing enough about this I'm not sure what to consider as the problem.  i suspect it's iis related or permissions, but not sure.

<script type="text/javascript">
    $(document).ready(function () {

        var msg = '@ViewData["Message"]';
            if (msg != "")
            alert(msg);  //problem line
    });

</script>
EE-Alert-Err.bmp
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros