1

I'm considering using this jquery utility as a possible solution, but I want to have a better understanding of it's use. Any thoughts?

qodeninja
  • 10,946
  • 30
  • 98
  • 152
  • 1
    I think you may need to be more specific in what you want to use it for and what other solutions you are thinking of implementing. In general, the function loads a script via AJAX and then executes it. Is fetching a script something that you need to do, or can you organise your code in a manner that doesn't require scripts to be fetched via a GET request to the server? – Russ Cam Mar 07 '10 at 21:39

1 Answers1

2

I don't know what you really want to know, but in essence:

  • It makes an (XMLHttp)request.
  • After that, it just creates an <script> node in the document (head, as far as I remember)
  • and sets the text of that script node to the contents of the response that it got from the request.

I struggled with debugging scripts included from the same domain in Firebug. Their source seem to vanish in the pits of jQuery.globalEval(). They work, they are certainly evaluated - it is just that globalEval seems to clear up everything after itself so debugging is near impossible. Also, some people seem to miss the ability to peek at the src attributes.

Community
  • 1
  • 1
Andras Vass
  • 11,478
  • 1
  • 37
  • 49