• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Get data from postal code api using jquery Ajax

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Guys i am trying to retrieve data from Indian postal code API. i don't know why it doesn't show anything. i am very new in JQuery please help me out .
Below is my code


 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are few syntax errors.
1. Remove space from url.
2. Remove "?" from url.
3. add datatype as JSON, becase server is returning data in JSON format
Paste the below URL in browser and hit enter, you can see what it is returning
http://www.getpincode.info/api/pincode?q=delhi

But this is still not going to work. Because it is a cross domain request returning JSON. and it is not allowed.
There is a workaround called JSONP, but for that you need a callback function which you dont have.

First you learn about these things. Gradually you will come to know.
JSON
JSON in AJAX
JSONP
 
parampreet Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much Tapas.can you please describe me how i can make cross domain request.and i really will appreciate if you can help me out to make works my code.
 
Tapas Chand
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

First you learn about these things. Gradually you will come to know.
JSON
JSON in AJAX
JSONP


Have you gone through these?
 
parampreet Singh
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i Just checked with this API admin. he told me that i cant use it with just jquery i should use server side language for make it works.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic