I'm trying to make a get request through jQuery from localhost (NodeJS) the get request works as expected when I check it with Postman, I should get json like this:
{
"name": "John",
"age": 16
}
When I run the code, the alert box doesn't show up, I able to get data from other url's which aren't localhost so I don't know what is wrong.
Hope you can help, here is my code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<script>
$(function () {
$.get("http://localhost:3000/", function (data) {
alert(data);
});
})
</script>
</head>
<body>
<p></p>
</body>
</html>