Home > Back-end >  javascript will not make web requests
javascript will not make web requests

Time:10-16

I am using an html document in my firefox web browser and is a file on my machine and Ive tried looking at web requests but it is showing none. I know for sure I have internet here is a reproduceable code below

<!DOCTYPE html>
<h1>StackOverFlow</h1>
<script src="js/jquery.min.js" language="javascript">

$.getJSON('https://jsonip.com/', function(data) {
  document.writeln("<p> "   JSON.stringify(data, null, 2)   "</p>");
});

</script>

CodePudding user response:

You need to have two <script> tags - one for jQuery and one for your code:

<script src="js/jquery.min.js"></script>

<script>
// Your code here
</script>
  • Related