简体   繁体   中英

jquery not working in asp.net mvc after publishing to localhost

I've built an mvc application which contains some jquery code. When I run the app from my ide, everything works perfectly. When I publish to the server and open the page, the jquery does not work. I get object expected errors.

i am not getting anything in the page,it shows error in loading dhtmlxsheduler.js can you help me out

You issue is most likely due to the way you are defining the path to the JavaScript file you are loading.

Make sure that you use a relative path , and not an absolute path when calling the file source.

If you have runat="server" you can also use the ~ operator, which ASP.Net translates to your home directory.

Read more here http://msdn.microsoft.com/en-us/library/ms178116.aspx

Your links to the .js files are broken. See the source code of your pages in your browser, and check the tag's src attribute. It must be pointing to the wrong place.

My guess is removing ../ do you have iis express? or development server? or iis?

Or use a CDN like this one from Google:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM