Request plain text file in javascript from URL?
<p>I started a blog recently and coded it by hand. It is a static, CSS/HTML5 website. Upon sharing it with friends, I realized that when I would update it via FTP, it would be cached already by their browsers. I decided that I would keep all of my blog posts on <em>new</em> pages and then create a landing page that would somehow determine the newest post and forward users there after they clicked an <em>enter</em> button or something like that. </p>

<p>I was able to create a button that could forward them to a specific link, but I want to create a script that will always forward them to the newest page. So I created a file called 'getLatest.json' and uploaded it to an 'api' subfolder of my site. I then tried to use an XMLHttpRequest to load it:</p>

<pre><code>function loadDoc() {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
        if (xhttp.readyState == 4 &amp;&amp; xhttp.status == 200) {
            window.location = "http://latestBlogPost.com" +
            xhttp.responseText.today; 
            //Today is a parent in the object returned.
        }
    };
    xhttp.open("POST", "http://myWebsite.com/api/getLatest.json", true);
    xhttp.send();
}
</code></pre>

<p>But that didn't work. The response was a null string. I tried using jquery to no avail.</p>

<p>I tried uploading a file called getLatest.html which contained the url in plaintext. That didn't work either.</p>

<p>tl;dr: Is there some way that I can get plaintext from a URL's html content?</p>

<p>edit: getLatest.json and getLatest.html contain a link to the newest blog post.</p>