初始页面加载中未加载Javascript [英] Javascript does not load in initial page load

查看:82
本文介绍了初始页面加载中未加载Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在必须加载我的JavaScript时遇到问题,当我第一次访问我的网站(php)(清除了Cookie)并单击链接(该链接称为javascript方法)时,它不起作用,但是,如果我重新加载页面,然后单击链接,它起作用(该链接不会刷新页面,但会调用另一个php页面并在网站上进行更改)...我正在使用jquery 1.3.2,如果有帮助

Im having issues with having to load my javascript, when I visit my website (php) for the first time(cookies cleared) and I click on a link (which calls a javascript method), it does not work , however if I reload the page and then click on the link, it works(the link does not refresh the page but calls another php page and makes changes on the site)... I am using jquery 1.3.2, if that helps

有人对此有解决方案吗?

Does anyone have a solution for this?

我网站的链接是 http://intellectuni.com

并且当您投票赞成我指的是

and the problem occurs when you vote for a post thats what I was referring to

这是我在IE8上遇到的错误 讯息:权限被拒绝 行:20 字符:25383 代码:0 用于文件jquery-1.3.1.min.js

This is the error I am getting on IE8 Message: Permission denied Line: 20 Char: 25383 Code: 0 for file jquery-1.3.1.min.js

谢谢

推荐答案

启动firebug,看看您是否真的通过网络发送了Javascript.是否有404或500的人通过?还是代码加载正确?您的事件处理程序被调用了吗?将console.logalert添加到您的处理程序进行测试.您的管理者甚至被依附吗?您是否将整个内容都放在了$(document).ready()中?您是否将脚本放在jquery.js文件之后,以便当脚本附加事件处理程序时jQuery可用?总的来说,您知道吗,做我们所有人都非常喜欢的调试工作.

Fire up firebug and see if you're actually getting Javascript sent down the wire. Is there a 404 or 500 whooshing by? Or is code loading correctly? Is your event handler being called? Add a console.log or alert to your handler to test. Is your handler even being attached? Did you put the whole thing in a $(document).ready()? Did you put your script after the jquery.js file, so that jQuery is available when your script attaches event handlers? In general, you know, do that debugging thing we all love so much.

这篇关于初始页面加载中未加载Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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