Posts

Showing posts with the label AJAX

Consuming Services from Client Side JavaScript (Part II)

In the previous post we discussed how we can call server side web/WCF services from JavaScript. in this post we will discuss how we can use Java Script Object Notation (JSON) to send/receive objects between client side JavaScript and server side services JSON JSON is a text based, human readable, platform independent data exchange format. it’s build on JavaScript object notations which allows you to define an object as a list of members and values that are enclosed in curly braces ( {} ), each member is delimited by a comma. Within each member, the name and value are delimited by a colon ( : ). the following example shows how you can define the object Car <script type= "text/javascript" > function DisplayCarInfo() { var car= { "Name" : "Mondeo" , "Model" : 2009, "Maker" : "Ford" , "Drivetrains" : "RWD" }; alert(car.Name); alert(car.Maker); alert(car.Model); alert(car.Drivetr...

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...

ASP.NET RadioButtonList and AJAX

I ran into a very strange problem that happens when you use a RadioButtonList as a trigger for an UpdatePanel, you can read more about this problem here