0

I am trying to make an ajax call on the below url

http://postalpincode.in/api/postoffice/tindivanam

which works fine with chrome address bar.

but if i use

 city  = 'Tindivanam';
jQuery.ajax({
    url: 'http://postalpincode.in/api/postoffice/'+_.toLower(city),
    method: 'GET',
    success:function(response){
        console.log(response)
    }
})

I am getting this

enter image description here

Musa
  • 96,336
  • 17
  • 118
  • 137
Alaksandar Jesus Gene
  • 6,523
  • 12
  • 52
  • 83
  • This API doesn't support CORS so you cant access it from client side js. You have to make the api call from a server side script. – Musa Apr 09 '19 at 15:44
  • 1
    Possible duplicate of [Why does my JavaScript get a "No 'Access-Control-Allow-Origin' header is present on the requested resource" error when Postman does not?](https://stackoverflow.com/questions/20035101/why-does-my-javascript-get-a-no-access-control-allow-origin-header-is-present) –  Apr 09 '19 at 15:52
  • I understand the CORS issue. But the call is a GET call and works fine on chrome window. In general get calls should get the html content as it is likely scraping the window. Correct me please. – Alaksandar Jesus Gene Apr 11 '19 at 03:29

0 Answers0