我在VIEW .cshtml文件中尝试使用json代码,但它给出'$ is undefined' [英] Im trying for a json code in a VIEW .cshtml file but it is giving '$ is undefined '

查看:202
本文介绍了我在VIEW .cshtml文件中尝试使用json代码,但它给出'$ is undefined'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用JSON调用csharp方法,但我的json编码正在运行VIEW而没有按钮单击

Im trying to call a csharp method using JSON,but my json coding is running VIEW without button click

推荐答案

你必须首先放置JQuery引用,at页面顶部。浏览器同步加载脚本标记,因此如果您在加载JQuery源之前尝试引用JQuery的
You have to put the JQuery reference first, at the top of the page. Browsers load script tags synchronously, so if you try to reference JQuery's


,那么您将收到未定义错误。



实际上,由于脚本标记会阻止页面的其余部分加载,因此最好将其他脚本标记放在JQuery引用下面的底部。这允许浏览器在加载脚本之前首先加载和显示页面标记。

http://stackoverflow.com/questions/17163422/jquery-not- defined-mvc4 [ ^ ]
before loading the JQuery source, then you'll get an "undefined" error.

Actually, since script tags block the rest of the page from loading, it might be better to instead put your other script tags at the bottom, underneath the JQuery reference. This allows the browser to load and display your page markup first, before loading the scripts.
http://stackoverflow.com/questions/17163422/jquery-not-defined-mvc4[^]


您的JavaScript文件未正确加载到您的页面中

您有一个拙劣的jQuery版本。这可能是因为有人编辑了核心文件,或者插件可能覆盖了
Your JavaScript file is not being properly loaded into your page
You have a botched version of jQuery. This could happen because someone edited the core file, or a plugin may have overwritten the


这篇关于我在VIEW .cshtml文件中尝试使用json代码,但它给出'$ is undefined'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆