Get content from the external URL using javascript

advertisements

I am using freetexthost.com to store my json code.. and now i ve to get those content from url using javascript,jquery,ajax... bt am being unable to get it.. am trying following code

<!DOCTYPE html>
<html>
<head>
<title>Useless</title>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.11.0.min.js'></script>
<script type="text/javascript">

$.ajax({
  type:     "GET",
  url:      "http://freetexthost.com/r56ct5aw03",
  dataType: "jsonp",
  success: function(data){
    console.log(data);
  }
});

</script>
</head>
<body>

<div class="content" >Hello</div>

</body>
</html>

getting an error as `Uncaught SyntaxError: Unexpected token <

is there any chances we can manipulate content of other page(url) using js...


You need to close your url using ":

$.ajax({
    type:     "GET",
    url:      "https://http://freetexthost.com/r56ct5aw03", // <-- Here
    dataType: "jsonp",
    success: function(data){
        console.log(data);
    }
});