external-script

Javascript external script loading strangeness.

I'm maintaining a legacy javascript application which has its components split into 4 JS files. They are "Default.aspx", "set1.aspx", "set2.aspx" and "set3.aspx". The ASPX pages writes out compressed JS from multiple (all-different) source files belonged to their respective set and set content-type header to "text/javascript". The appl...

Best way to link to external scripts in Document HEAD

I've noticed many sites use this, without closing the tag. <script type="text/javascript" src="editor.js"> This style is also recommended but is longer: <script type="text/javascript" src="editor.js"></script> Can I write it like this? Is it valid or is there a better way? <script type="text/javascript" src="editor.js" /> ...

How to get current Joomla user with external PHP script

I have a couple PHP scripts used for AJAX queries, but I want them to be able to operate under the umbrella of Joomla's authentication system. Is the following safe? Are there any unnecessary lines? joomla-auth.php (located in the same directory as Joomla's index.php): <?php define( '_JEXEC', 1 ); define('JPATH_BASE', dirname(__FILE...

chain of dynamic external javascript calls

I'm not exactly sure how best to phrase my question, so I'll start by explaining what I am trying to do. I have a page that has some code similar to a Google Analytics pixel code. Something like this: <div id="mydiv"></div> <script src="blahblah.php"></script> The PHP script returns some javascript that will insert another snippet i...

Is it possible to load Jquery in the body of a page.

Hi everyone, I am using code-igniter, and some of my views require jquery. Because they must be used in multiple places they must call jquery in their file, however since they are referencing an external file, calls to $(document.ready) are evaluated before loading jquery and therefore fail. Is it possible to put jquery in the body and ...

Load external script in <head> in Drupal 6

I want to load an external script in <head>. It is module specific so I want my module to take care of the loading. In Drupal 6, function drupal_add_js() does not allow to add an external script in <head>. It will be available in Drupal 7 passing the "external" argument to the function. In D6, I can use drupal_set_html_head() instead, b...

Javascript not executing when placed in external script file

I'm building an ASP.NET MVC site where I need a tag editor, similar to the one used on Stack Overflow. I've already looked up how to accomplish the necessary autocompletion with jQuery UI, but I've run into a problem: when I place the script in an external .js file, it doesn't execute. Here is my test.html: <html> <head> <meta ch...