Forums

Ajax call working on phones but not computer browsers

I have a simple call to a URL, from HTML, using Ajax, when I click on a checkbox. It works perfectly in my development environment. With PythonAnywhere it works properly on my phone, but when using browsers on my computer (e.g. Chrome and Firefox), nothing happens when I click on the checkbox. The function does not run. I have tried it with and without window.location.reload(). What makes this more confusing is that it used to run on PythonAnywhere without any problems. Any help with this would be greatly appreciated.

<input {{ c_typed }} onclick="TypedPy()" class="checkboxes" type="checkbox" id="typed" name="typed" value="typed">

<script src="http://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256- FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script>
        function TypedPy(){
            $.ajax({
              url: "typed1",
             context: document.body
            }).done(function() { window.location.reload() });
        }
</script>

Use the network tab of your browser's developer tools to see what is happening to the request.