javascript - Get contents of external file and define as variable -


Is it possible to define a varible as the contents of the external text file?

Example:

  function getfile () {var textfromfile = (content http://example.com/plain.txt); }  

Plain.txt is a line and does not have long particlaly.

Because I'm using it for Chrome Extensions, I do not have permission to use PHP - is it an easy way in Javascript?

You Using JQuery can call Ajax and assign variable response,

$ .ajax ({url: "plain.txt", cache: incorrect}) .Done (function (html) {useIt (html);}); // useful for using variables after using callback function (variable) {warning (variable); }

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

objective c - How to open front/back camera at the same time in iOS developing? -

xml - XMLStarlet - UTF-8 Nordic characters -