jump to navigation

Ajax Data Transfer Format for Sending Data to the Server Side January 24, 2007

Posted by Binny V A in Digg Links.

JSON has taken the award for the easiest method for transporting data when using Ajax. JSON is great to get data from the server side to the client side. What what about when you need to send data to the server side? Sure you can use JSON then – but the advantage of using JSON is lost. So I propose using another format for it – UED or URL Encoded Data. Its a very simple concept – and it has been in use for a long time – all I have done is create a function that will encode the data into this format. The basic concept behind this is that the most used data structures can be easily encoded into a URL. You can create variables, numerical arrays, associative arrays, multi-level arrays etc. using existing syntax. The best part is all the server side languages are capable of handling this format – so no parsing is needed.

ued_encode() will take an array as its argument and return the data encoded in UED format – as a string. You can use that string to send the data via POST or GET in the query part of the URL.

read more



1. Profandesign - January 24, 2007

Not quite…

Have recently been working with JSON, if you serialize the json object and post that to a PHP-file and do json_decode() on the string (only most recent versions of PHP, otherwise see common php-json-libs) you get a php object, so you keep the object structure all the way through your application which to me makes a lot more sense than converting a perfectly good and useful object into a string that you have to parse…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: