O'Reilly logo

ASP.NET jQuery Cookbook by Sonal Aneel Allana

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using complex data types with AJAX

So far, we have seen how AJAX calls can be made by passing simple data types as parameters. Let's focus now on a scenario where we might need to pass a complex data type such as an object instead.

Getting ready

  1. Add a web form Recipe6.aspx to the current project.
  2. Download Json2.js file from http://www.json.org/js.html and save to the js folder.

    Note

    To convert an object into JSON format we will use the stringify() function available in Json2.js written by Douglas Crockford ( http://www.crockford.com/).

    <script src="js/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="js/json2.js" type="text/javascript"></script>
    
  3. Create a simple user login form with the following markup:
    <form id="form1" runat="server"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required