0

I have a query result generated on a local server in json format using a link similar to the one below. when I copy and paste the generated result and save it on a file locally and call that, it reads it fine and I dont get an error (it goes to the success function), but if it accesses it via the url as shown below, it goes to the error function. Anyone knows what i'm missing here?

  <script>

  $.ajax({
    url: "http://localhost:5001/time_interaction/19790101/19800101/month",
    dataType:'JSON',
    success:function(data){
      console.log(data)
    },
    error:function(){
      console.log('error')
    }
  });

  </script>
BKS
  • 2,227
  • 4
  • 32
  • 53
  • You're missing the error being included in this question, for a start – millerbr Mar 29 '16 at 22:28
  • i mean it types 'error' in the console (as shown in the code). and doesn't go to success, – BKS Mar 29 '16 at 22:30
  • Add in the error parameter to your error callback, and then log that and post what it says. Or use the browser debug tools (network tab) to see if the error is being output there. This question can't be answered unless you tell us what the specific error is. – millerbr Mar 29 '16 at 22:31
  • Have you tried this? http://stackoverflow.com/questions/4064444/returning-json-from-a-php-script That is if you are using PHP on your server – Xsert Mar 29 '16 at 22:32

0 Answers0