[Secure AJAX for PHP] SAJA

SAJA Demo Page

Note: Sourceforge servers are fairly slow due to their high demand. You can expect SAJA to perform much faster on a more responsive host. On the up-side, this allows you to fully experience the sajaStatus "Working..." indicator, as well as observe what happens when you multithread saja requests by clicking the buttons really fast.

True UTF-8 Character Set Mode

Saja can handle the UTF-8 character set, use the area below to test. The response should echo unchanged on the right hand side. Please beware that the PHP string functions are not capable of handling UTF-8, so you may experience strange problems if you do not take special care. Notice the incorrect string length as calculated by PHP.

PHP String Length:

Extended ASCII Character Set Mode

In the limited extended ascii mode (default) some characters will be interpreted as question marks, but you won't have trouble with string manipulation in PHP. Most of the time you'll be fine in this mode unless you want to use characters outside of most european languages. Notice that some characters are converted to ?, but the string length as calculated by PHP is correct.

PHP String Length:

AJAX + Browser History Demo

One of the major shortcomings of ajax applications is that they tend to break the traditional browser navigation - if a user clicks the "back" button they find themselves suddenly on an unexpected page. SAJA provides a simple solution to this problem by storing the previous AJAX request data in a javascript history chain. Try clicking the 3 buttons below in order, then use the "back" and "forward" buttons on your browser to "navigate" your previous ajax requests! Please note that there are logical and practical limitations to this feature as explained in greater detail here: ajax + browser history explained.


Simple Adder Demo

This demo uses a simple php function to either add two numbers or concatinate two strings, depending on the input. This function is being called from a separate library, "moreFunctions.php", instead of the standard "saja.functions.php" file.

+ =


Grab the Title of any Page

Use SAJA to make a request to retrieve the title of the URL you type in. **The sourceforge server can only request documents on the sourceforge domain, sorry!

URL:

	

Sleeping PHP Demo

Observe a delay created by the PHP sleep function, as well as callback response order.


Convert JavaScript Objects to PHP Arrays

Send JavaScript Objects directly into your php functions.

Javascript Objects / Arrays, Sent to PHP

<script>
var myArray = ['is', 'an', 'array', 1, '2', 3];
var myObject = {first:'is', second:'aÑ', third:'object'};
</script>



Form Components

Try clicking around on these form elements to calculate the answer.

10 =

Add One to the answer?

Text contains: characters.

Updating Element Styles

Background Color: # Text Color: #