为什么下面的jquery代码不能运行呢?
Why doesn't the following piece of jquery run?
我试图用jquery/ajax获取一些html,将其加载到div中,然后调用带有盲目效果的show方法。但是我不知道我这辈子到底出了什么问题。
$(document).ready(function() { // The relevant jQuery
$("#effect").hide(); // Make sure the div I'm going to show is not visible first off.
$("#foo").click(function(){ // foo is a button
$.ajax({url:"after.html", success:function(result){ // Grab the html I want. (just an <h1> tag)
$("#effect").html(result).show("blind", {direction: "horizontal"}, 400); // When I comment out this line it works, but with the exception of the id's to select it's exactly the same as in another working page.
alert("loaded after.html...");
}});
});
});
HTML: <div class="narrow">
<p><input type="submit" id="foo"/></p>
</div>
<div id="effect" style="background-color:white; float:right; height:400px; width:400px;">
</div>
不调用$("#effect").html(result).show("blind", {direction: "horizontal"}, 400);
行,一切运行正常。然而,这一行在控制台中显示为Uncaught SyntaxError: Unexpected end of input
。(铬)
当我遇到这个问题时,我正在使用这个页面作为参考。
这是怎么回事?
盲目效果是JQueryUI的一部分。在您分享的教程中,您可以看到该代码。你确定像jquery-ui-1.7.2.custom.min.js
这样的东西在你的页面上被引用为:
<script type="text/javascript" src="/jquery/jquery-ui-1.7.2.custom.min.js"></script>
相关文章:
- ASP.NET 应用在VS2010中运行,但在发布/部署后不能运行
- javaScript在被ajax加载时不能运行
- Flexslider jQuery插件不能运行幻灯片
- 不能运行我的Node.Js应用程序与我的机器的IP地址,但可以与本地主机
- 为什么这个javascript热/冷应用程序不能运行?
- c# WPF应用程序浏览器不能运行angularjs
- Php编程错误(不能运行while循环)
- 不能运行简单的Jquery函数
- 有人能解释为什么这个JavaScript不能运行吗?
- 为什么这个javascript不能运行,我们的目的是在弹出式
- 不能运行或测试我的NodeJS脚本
- 不能运行任何JS相关的东西.MVC页面
- 我有编程经验,但不熟悉Javascript,我不知道为什么我的代码不能运行
- Ruby on rails -不能运行javascript
- 为什么html5视频不'不能运行在Chrome使用爆米花.js
- 不能运行yui jar文件-缺少变量名和函数体后缺少}
- 为什么JavaScript不能运行?
- 可以运行Javascript,但不能运行jQuery
- 不能运行xmlHttp.本地服务器上的responseXML
- 为什么这个程序不能运行