Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi ,

i have a json webserive :-

URL = http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo

which will give output in JSON Format, the output of this webserive i want to bind it to a table , for that i am trying the below code but not able to bind it . any changes i need to do in below code ?

Code:-


HTML
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <script src="Scripts/jquery-1.9.1.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
        function callservice() { 
        $.ajax({ 
            type: "POST", 
            url: "http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo", 
            contentType: "application/json; charset=utf-8", 
            dataType: "json", 
            success: function (response) { 
                var Employee = response.d; 
            }, 
            failure: function (msg) { 
                alert(msg); 
            } 
        }); 
    } 
 
    </script> 
 
 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
         <button id="btnsample" runat="server" onclick="callservice();" >Run Service</button> 
         <table id="tbldata"></table> 
    </div> 
    </form> 
</body> 
</html>
Posted
Comments
I was trying to solve this, but when I access
http://api.geonames.org/findNearbyPlaceNameJSON?lat=47.3&lng=9&username=demo
, it throws error like below...

the deaily limit of 30000 credits for demo has been exceeded. Please use an application specific account. Do not use the demo account for your application..

So, from the error, it is clear that you need to get one valid "username" parameter other than "demo".

Please provide a correct url of service and I will try again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900