CBAx simple

Cross Browser Ajax

Cross Browser Ajax (CBA) is a tiny, fast, and truly cross browser library that makes adding AJAX features to your pages very easy.

Version: 1.10

License: MIT (Free for all use)

Library Size: 4.9Kb (Compressed) 12.8Kb (Non-compressed)

Download C.B.A.

Cross Browser Ajax (CBA) Description

Key Features:

  • Extended Cross Browser Compatibility.
    Works with IE5.0+ ( even with disabled ActiveX ), Mozilla1.7+, Firefox1.0+, Opera7.3+, Safari
  • Small size. 4.9Kb compressed
  • Data can be loaded from different host
  • Easy-to-Use.

How To Use CrossBrowserAjax Library?

Using the CrossBrowserAjax to create dynamic content is very simple. There are two steps.

1. Include a library file in your <head></head> section like this:

<script src="cba.js"></script>

2. Make the Ajax request and update content by calling cbaUpdateElement(elementID,url), for example:

<span id="myElement"></span><a href="javascript://" onClick="
cbaUpdateElement('myElement','userinfo.php?data=mydata');
">Update myElement</a>

It will load data returned from "userinfo.php?data=mydata" to "myElement".

That's it!


Ajax Response in CrossBrowserAjax

The server response in this example should look like this:

_cba.ready (
   0, // request id
   'Data...' // data
);

A request handler can be written in any server language (PHP, JSP, ASP etc..). Every CrossBrowserAjax response must be wrapped in _cba.ready

_cba.ready (
    // your response data here
);

The server request handler for our example, written in php ( userinfo.php ):

<?php $answer = 'Data...'; ?>
_cba.ready (
   <?php  echo $_GET['_cba_request_id'];?>,
   "<?php echo addslashes($answer);?>"
);
# XHTML valid # CSS valid