What are some arugments for/against using jQuery.getScript()?
I'm cons开发者_运维知识库idering using this jquery utility as a possible solution, but I want to have a better understanding of it's use. Any thoughts?
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.
精彩评论