jordsta95
jordsta95

Reputation: 119

Get content from raw.github and displaying on website

I am allowing members of a community to put the information they want on a web page made just for them, so I was wondering if it was possible to allow the user to use rawgitub (which just displays the text) and use that for them to change their info at will.

Looking around for something similar to this, I found the following, however, it seems to not work. Any idea what I am doing wrong?

 <script type="text/javascript">setTimeout('read',30);function read(){  jQuery.get('https://raw.githubusercontent.com/jordsta95/ArcaneArteries/master/aaversion.txt',function(data){document.write(data);});}</script>

Upvotes: 0

Views: 144

Answers (1)

6ton
6ton

Reputation: 4214

You are passing a string to setTimeout, it should be the function or a reference to the function:

setTimeout(function read(){
      $.get('https://raw.githubusercontent.com/jordsta95/ArcaneArteries/master/aaversion.txt', 
          function(data){
              document.write(data);
          }
      );
}, 30);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Upvotes: 1

Related Questions