hello jQuery experts!
i am new to jQuery and i need help in getting getJSON method to work.
Here is my code:
- <html>
- <head>
- <script src="http://code.jquery.com/jquery-latest.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $("button").click(function(){
- $.getJSON("http://api.worldbank.org/countries/PHL/indicators/GDPPCKD?per_page=10&date=2005:2010&jsoncallback=?",
- {format:'json'},
- function(data){
- alert('this function is working.. hooorayy!');
- //process the data here
- } );
- });
- });
- </script>
- </head>
- <body>
- <button> Get World Bank Data </button>
- </body>
- </html>
the callback function is not executed but when i checked the response using firebug,
it shows:
[
{
"page": 1,
"pages": 1,
"per_page": "10",
"total": 6
},
[
{
"indicator": {
"id": "GDPPCKD",
"value": "GDP per Capita, constant US$, millions"
},
"country": {
"id": "PH",
"value": "Philippines"
},
"value": null,
"decimal": "0",
"date": "2010"
},
{
"indicator": {
"id": "GDPPCKD",
"value": "GDP per Capita, constant US$, millions"
},
"country": {
"id": "PH",
"value": "Philippines"
},
"value": null,
"decimal": "0",
"date": "2009"
},
{
"indicator": {
"id": "GDPPCKD",
"value": "GDP per Capita, constant US$, millions"
},
"country": {
"id": "PH",
"value": "Philippines"
},
"value": null,
"decimal": "0",
"date": "2008"
},
{
"indicator": {
"id": "GDPPCKD",
"value": "GDP per Capita, constant US$, millions"
},
"country": {
"id": "PH",
"value": "Philippines"
},
"value": null,
"decimal": "0",
"date": "2007"
},
{
"indicator": {
"id": "GDPPCKD",
"value": "GDP per Capita, constant US$, millions"
},
"country": {
"id": "PH",
"value": "Philippines"
},
"value": null,
"decimal": "0",
"date": "2006"
},
{
"indicator": {
"id": "GDPPCKD",
"value": "GDP per Capita, constant US$, millions"
},
"country": {
"id": "PH",
"value": "Philippines"
},
"value": null,
"decimal": "0",
"date": "2005"
}
]
]
Is there something wrong with my code? your help will be very much appreciated.