Ajax.load wont work when pressing a button : <p>I am trying to run ajax.load method when pressing a button. The idea is very simple: change the body of a  to something else, by using the ajax.load method. However, i havent been succesful yet, and after researching for a couple of hours, i still havent found the solution. Nothing happens when i press the button.</p>

<p>i have tried to copy/paste one of w3schools examples into my own project, just to see if it works on my computer. The result was that it didn't work on my computer, even after changing the files in the example to my own files. this makes me think that there is a problem with how ajax has been put into the project. but i am not sure.
The example is here: <a href="https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_load" rel="nofollow noreferrer">https://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_load</a> </p>

<p>my test-website is running on a tomcat server and is written in intelliJ. Here is the code:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;AjaxTest&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script&gt;
    $("#button").click(function () {
        $("#maincontainer").load("ajaxTestAlternativeText.txt")
    })

&lt;/script&gt;

&lt;div id="maincontainer"&gt;
    this text needs to change
&lt;/div&gt;

&lt;button id="button" type="button"&gt; tryk her :)&lt;/button&gt;


&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>in the code above, i change the body to a .txt file. I have also tried with changing to a .html file, but that didn't work either.</p>
