0

I'm deploying a simple asp mvc 2 application on my local IIS 7.5 server. But when I try to run some javascript

    
            $(function () { alert("works"); })
    

in view or Site.Master, I do not see any alert. What is the problem?

1 Answer 1

1

there can be a couple of problems

 $(function () {
   alert("works");
   });   <--------- you are missing a semi colon

make sure you have included the jquery

if you are loading jquery from the google cdn it might be possible that its blocked on the server in that case reference to the jquery.js saved on your server

Sign up to request clarification or add additional context in comments.

4 Comments

I get this error "Uncaught ReferenceError: $ is not defined" after putting semicolon, by the way: I don't think the semicolon does any matter in this case.
@Nozim yes the problem is you have not included the jquery in your project
I solved the problem with referencing to google libraries but, I want to have my dependencies satisfied locally.
then download the jquery and reference from your local server location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.