哪里是放的JavaScript / AJAX文档中的最好的地方?最好的、文档、地方、JavaScript

由网友(深海蔚蓝)分享简介:道歉的愚蠢的冠冕堂皇的问题,但我需要的专家澄清。Apologies for the dumb sounding question, but I need the experts to clarify.出了三地把Javascript中,头, $(文件)。就绪或体,其中,将最好的地方是把一些Ajax,使用了大量的 $...

道歉的愚蠢的冠冕堂皇的问题,但我需要的专家澄清。

Apologies for the dumb sounding question, but I need the experts to clarify.

出了三地把Javascript中, $(文件)。就绪,其中,将最好的地方是把一些Ajax,使用了大量的 $ GET 功能?

Out of the three places to put Javascript, head, $(document).ready, or body, where would the best place be to put some ajax that uses a lot of $GET functions?

比如我现在用所谓的JavaScript函数 execute_send(),但我不能确定其中最好的地方把它将会是。以下是错误:

For instance I am using a JavaScript function called execute_send() but I am unsure where the best place to put it would be. Below is the error:

在行67字符22问题:execute_send是用它被定义之前。 功能execute_send(){

Problem at line 67 character 22: 'execute_send' was used before it was defined. function execute_send() {

另外如何安置影响页面加载时间?

Also how does the placement affect the page loading time?

推荐答案

在一般情况下,除非出于某种原因,你在其他地方需要它,把你所有的JS最后在体内。该浏览器将不会继续下去,直到它分析你的JS,所以它是好的,让网页加载第一。请参阅http://developer.yahoo.com/performance/rules.html

In general, unless for some reason you need it elsewhere, put all of your JS last in the body. The browser won't continue until it's parsed your JS, so it is nice to let the page load first. See http://developer.yahoo.com/performance/rules.html

阅读全文

相关推荐

最新文章