Questions tagged [getscript]

188 questions
64
votes
9 answers

jQuery.getScript alternative in native JavaScript

I'm trying to load JS scripts dynamically, but using jQuery is not an option. I checked jQuery source to see how getScript was implemented so that I could use that approach to load scripts using native JS. However, getScript only calls…
ILikeTacos
  • 17,464
  • 20
  • 58
  • 88
50
votes
10 answers

How can I include all JavaScript files in a directory via JavaScript file?

I have a bunch of JavaScript files that I would like to include in the page, but I don't want to have to keep writing So is there a way to include all files in a directory (unknown size)?…
Hristo
  • 45,559
  • 65
  • 163
  • 230
34
votes
6 answers

Jquery getScript caching

By Default $.getScript() disables caching and you can use $.ajaxSetup and set caching to true. When testing if the script is actually cached with Firebug most of the time the script is coming back at 200 (Which means the script is a fresh copy) and…
Case
  • 4,244
  • 5
  • 35
  • 53
25
votes
5 answers

Can I prevent history.popstate from triggering on initial page-load?

I'm working on a site that serves content via AJAX. If you click an item in the menu, a content div gets updated with $.get response, nothing fancy. I'm implementing history.pushState to allow navigation with the browser's back/forward button. I…
jassa
  • 20,051
  • 4
  • 26
  • 24
24
votes
8 answers

Using getScript synchronously

I'm writing an engine that requires the use of getScript quite extensively. I've pushed it into its own function, for ease of use, but now I need to make sure that the function itself is synchronous. Unfortunately, I can't seem to make getScript…
VashGH
  • 263
  • 1
  • 2
  • 8
13
votes
4 answers

Can I use jquery getScript() without a callback?

I need to use a javascript function from an external js file inside another js file. This is basically the code I've tried: $.getScript('js/myHelperFile.js'); myHelperFunction(); This doesn't work - I get an error of "myHelperFunction is not…
froadie
  • 79,995
  • 75
  • 166
  • 235
9
votes
4 answers

ReCAPTCHA ajax loaded theme problem

Can not figure out how to theme an ajax loaded recaptcha. The below code does not work. From Google Recaptcha Saw this post Recaptcha ajax API custom theme not working, but I am definitely viewing in localhost and recaptcha is working fine, just…
jhanifen
  • 4,441
  • 7
  • 43
  • 67
8
votes
3 answers

jQuery getScript

I'm currently stuck using several JavaScript libraries that MUST load in a very specific order. Since jQuery's getScript() is asynchronous it starts downloading all of the scripts very quickly and, as they finish, executes them. Since they do not…
Kris
  • 1,789
  • 3
  • 18
  • 27
8
votes
2 answers

Using $.getScript (jquery): code is not executed

I am working on updating my website, which now uses an AJAX engine. My engine works well, up-to-hand for some reason some pages do not execute javascript, let me explain: when the anchor change I use $.get for data recovery. The pages have this…
Pierre Tassel
  • 436
  • 3
  • 9
8
votes
4 answers

Detect if script has already loaded or not

It seems that helloworld.js gets loaded multiple times based on the number of times I click #load. I say this because when I look at Google Chromes Developer Tools Network tab, it shows helloworld.js as many times as I click…
oshirowanen
  • 15,297
  • 82
  • 198
  • 350
7
votes
2 answers

How to delete script loaded by .getScript()

When I load a script with .getScript('file.js') is there a way to do remove that script later? sort of like a clean where I say delete the js I loaded earlier
twitter
  • 8,895
  • 6
  • 22
  • 20
7
votes
5 answers

getScript jQuery path not working / Ruby on Rails

I've got a jQuery function that is called after a doubleclick on a list item. app/assets/javascripts/tile/tile.js $('#list > li').dblclick(function(){ // styling $(this).toggleClass('liked'); // pass ID to controller var movie_id =…
davegson
  • 8,205
  • 4
  • 51
  • 71
6
votes
1 answer

Incomplete XHR responses from IIS with compression

I'm loading scripts with jQuery ajax. Here's a snip from the loader code, for what it's worth. var resources = ['knockout-3.2.0.js', 'fonts/fontawesome-webfont.eot', ... ]; var retryCount = 0; load(0); function load(i) { if (i ==…
Peter Wone
  • 17,965
  • 12
  • 82
  • 134
5
votes
2 answers

jQuery getScript returns an parse error exception

I'm trying to load two scripts with the $.getScript function of getting Google Map script, then after that is loaded, I get another script (goMap) which makes map applets easily to be made. However, when loaded, the first script of getting Google…
MacMac
  • 34,294
  • 55
  • 151
  • 222
1
2 3
12 13