lundi 4 juillet 2016

How to consume Web API weather report url using Ajax in asp.net webform with giving input as city name in dropdown

As am new to Web API am not able to get weather WEB API using asp.net and code behing as c#.net and i have url with key http://ift.tt/1vwz3X6
and javascript code
<script src="http://ift.tt/Yg0phv"></script>
<script>
jQuery(document).ready(function($)

{ $.ajax({ url : "http://ift.tt/29p7gDG", dataType : "jsonp", success : function(parsed_json) { var location = parsed_json['location']['city']; var temp_f = parsed_json['current_observation']['temp_f']; alert("Current temperature in " + location + " is: " + temp_f); } }); }); So please help me that how to call this in code behind where it will accept dropdown value as city and display weather report of that particular city.To call the above method in webforms,Please send me c# code to call the above function.




Aucun commentaire:

Enregistrer un commentaire