Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28620

Re: Can AJAX request a .js file?

Path csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript
Subject Re: Can AJAX request a .js file?
Date Fri, 4 Sep 2015 00:44:30 +0200
Organization solani.org
Lines 27
Message-ID <msaig8$4b8$1@solani.org> (permalink)
References <9ba8b186-10e2-4510-b456-8d38608db644@googlegroups.com> <ms7s66$a64$1@solani.org> <835728ac-fe10-4a65-a719-e3aec3ec02de@googlegroups.com> <ms7u7v$hf8$1@solani.org> <92e68ba6-df1f-4479-921d-15bb219aba89@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1441320264 4456 eJwFwQkBwDAIA0BLZEAoclYe/xJ650qwwug0X1/aZVSqIxNVg7AN76XcmdVuQZzzYRUyU/8DFeoROQ== (3 Sep 2015 22:44:24 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Thu, 3 Sep 2015 22:44:24 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0
X-User-ID eJwVxsERwDAIA7CVQsDmGAeTZv8R2uolOI2TQTBwcYfJA9i0RTt3/C25dFLVtflwuYVr6Vu+Fl8QvQ==
In-Reply-To <92e68ba6-df1f-4479-921d-15bb219aba89@googlegroups.com>
Cancel-Lock sha1:bAlYuam3z9QLA10WX3qas5Uf7fs=
X-NNTP-Posting-Host eJwFwQERADEIAzBLYy2Ul8Pg8C/hE0dYtBge9PUdAnUSY3KfPqiafG8p3oRkhqxLnbH+evsHEK0Qww==
Xref csiph.com comp.lang.javascript:28620

Show key headers only | View raw


Jay Braun wrote:

> Thank you.  The script is definitely coming over (verified with the console browser).  But the JavaScript, which works when loaded statically with a <script> tag, is not executing.

Are you sure that it isn't evaluated?  I can imagine that the script
registers an event listener for the onload event of the Window object or
such.  In this case the listener may be registered, but never triggered.

There may be other reasons why the code doesn't work as expected, even
though the script is evaluated.

> My script contains many double quotes.  Do I need to escape them?

No.  (That would be necessary, though, if you would evaluate code in a
string literal.)

> Just for reference, here is the JavaScript code that requests the JavaScript file every 2 seconds (the "every 2 seconds" in just for testing purposes):
> 
>         request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
>         request.send();

I don't think it makes sense to set a Content-Type request header, when
the body of the request is empty.

-- 
Christoph M. Becker

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-02 14:47 -0700
  Re: Can AJAX request a .js file? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-03 00:11 +0200
    Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-02 15:15 -0700
      Re: Can AJAX request a .js file? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-03 00:46 +0200
        Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-03 12:50 -0700
          Re: Can AJAX request a .js file? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-09-04 00:14 +0200
          Re: Can AJAX request a .js file? "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-04 00:44 +0200
            Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-03 18:52 -0700
              Re: Can AJAX request a .js file? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2015-09-04 18:28 +0200
                Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-04 15:47 -0700
                Re: Can AJAX request a .js file? Stefan Weiss <krewecherl@gmail.com> - 2015-09-05 03:12 +0200
                Re: Can AJAX request a .js file? Jay Braun <lyngwyst@gmail.com> - 2015-09-05 20:09 -0700

csiph-web