When I dynamically load a script with jquery
...
options = {
dataType: "script",
cache: true,
url: "...appContr.js"
}
return jQuery.ajax(options);
...
and I debug the script with firebug, this script has the name “1” and everything is in
one line (or in a few lines). I cannot use this for debugging.
I use Firefox 10.0.2 and Firebug 1.9.1.
When I use LAB.js
$LAB.script("...appContr.js").wait(function() {
...
});
or require.js
The file has its line breaks and the name of the script is “appContr”.
How can I change the jQuery command in order to get the same result?
Thanks a lot in advance
EDIT:
Thank you, Headshota, for your answer, but this does not help.
Besides, getscript does not cache the contents, and this is important for me.
EDIT:
Thank you, Marlin, for your answer:
The whole thing works without firebug enhancements when I load the script with lab.js or require.js, the problem is only with jquery script loading.
In firebug I have the tabs console, html, css, script, dom and network.
If I go – after jquery script loading – to script and view the script, there are no line breaks in the code.
But when I go to the “tab” console, I have one entry for the get request. When I click
“answer” in this get request, the script contains the line breaks. But this does not help me because in the “script” tag the line breaks are missing.
dataType: scripttellsjQuery.ajax()to interpret the response as JavaScript and evaluate it.An evaluated code basically has no file, line number and probably no white space. If you try to debug it in FireBug, it will probably tell you that it is “eval()ed” code.
JavaScript loaders such as LABjs work by injecting a
<script src>tag in your document; it is easier for FireBug to debug because the JavaScript filename, file content and line numbers are all available.