Consuming Services from Client Side JavaScript (Part I)
Many frameworks allow you to easily call a server side service from JavaScript directly, services are called asynchronously from JavaScript so when you call any service method from JavaScript you can supply two extra parameters to the method in addition to the original method parameters, the first one is the name of a javascript function that will be called once the result of the service method is received, and the second one will be called incase an error happened on the server. In this post i will explore the options available to consume a service from client side JavaScript. - Calling a page method: ASP.NET AJAX allows you to call public static methods available on your aspx page directly from JavaScript, you have to mark these methods with the [WebMethod] attribute and set the EnablePageMethods property of the script manager control to true. the following example demonstrates this //Default.aspx.cs [System.Web.Services.WebMethod] public static string GetTemprature( string city...