First question:
@Url. Content Reference Issues
<script src= "@Url. Content (" ~/scripts/artdialog/jquery.artdialog.js?skin=blue ")" Type= "Text/javascript" > </script>
<script src= "~/scripts/artdialog/jquery.artdialog.js?skin=blue" ></script>
Today wrote an MVC demo, the folder structure is very simple, as follows: The use of EF to generate the model framework and manually add table field annotations, but on the page JS verification is always not displayed. There is no language. Inadvertently press F12 in the browser, see prompt:
Failed to load resource:the Server responded with a status of 404 (not Found) http://localhost:1445/~/Scripts/jquery. Validate.min.js
Failed to load resource:the Server responded with a status of $ (Internal server Error) HTTP://LOCALHOST:1445/~/SCR Ipts/jquery.validate.unobtrusive.min.js%22estimation is the path of the path JS file problem, hurriedly looked at the following layout.cshtml view:
Sure enough, the 11,12,13 line of code runs when it is mapped to:
There is a problem with the mapped physical path. The actual jquery is in the root directory of the website, and no longer under the test folder!
Remove these lines of error and use the @url.content () function map to convert the virtual (relative) path to the application absolute path.
PS: To use the MVC automatic verification, in addition to the model write annotations, introduce jquery-1.5.1.min.js, but also to pay attention to whether the introduction of jquery.validate.js. From the name can be learned, that is the set of JS authentication method. The default MVC3 empty project and the _layout.cshtml of the Internet do not refer to jquery and validate.js. (The post refers to the original author address: http://www.cnblogs.com/nlh774/p/3594666.html)Second question:
<script src= "@Url. Content (" ~/scripts/artdialog/jquery.artdialog.js?skin=blue ")" Type= "Text/javascript" > </script>
<script src= "@Url. Content (" ~/scripts/artdialog/jquery.artdialog.js ")" Type= "Text/javascript" ></script >
And whether the "? Skin=blue" difference is added to the path:
Recently in doing a project there is no suffix directly resulting in a bullet box exception as follows:
It should have been shown as follows:
To record the issue.
@Url. Content issues