Direct HTTP Calls

In addition to the high level server and client side controls the Web Toolkit also helps in making quick and dirty HTTP callbacks to the server. These are based on the jQuery functions that are already available specifically $.ajax(). We highly recommend that you use the jQuery AJAX functions (.get(),.post(),getJSON() etc.) if they fit their simple specific scenarios.

If you want a little more control the $.ajax function lets you do just about anything, but its use requires a rather long list of options and it gets tricky when error handling is involved. For this reason the ww.jquery.js library provides a number of helper classes that assist with AJAX functionality.

  • HttpClient
    A wrapper around the $.ajax() function that provides intrinsic support for two-way JSON conversion as well as more consistent error handling - errors are returned as an object that has parsed various kinds of errors (client, transport, server). Exposes most $.ajax features with most common defaults and optimized for JSON method calls against WCF/ASMX and [CallbackMethod]s.

  • AjaxMethodCallback
    This is the client side object that can be used to call WebToolkit [CallbackMethod] methods on the server. If you are making callbacks to your own application this is amongst the easiest ways to do it.

  • ServiceProxy for WCF/ASMX Callbacks
    This simple class provides for simple callbacks to WCF or ASMX web services. It wraps HttpClient and handles the WCF/ASMX specific encodings of inbound parameters and result values.

  • ajaxJson()
    Similar to the jQuery $.getJSON() function, but supports passing in a single object or value that is converted into JSON first. Another easy way to call either [CallbackMethod] in the Toolkit or WCF/ASMX services. For WCF/ASMX services you need to create an object with properties for each parameter. ({parm1: "Rick", parm2: new Date() }).

  • ajaxCallMethod
    Shortcut version of the full AjaxMethodCallback class that provides a one liner to call [CallbackMethod] handlers or page/control methods without requiring an AjaxMethodCallback control on the page.

© West Wind Technologies, 1996-2016 • Updated: 12/19/15
Comment or report problem with topic