Site Moved

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.

> why not comma-separate multiple items inside a parameter/escape dataThis will require some parsing on the server side - and if the data has comma, more complication arises.

Even in flat forms, you can use checkboxes and multiple selection select boxes to send arrays to the server side. My solutions uses the same format they use.

> What type of wepapps(?) have you found the need for posting arrays to the server?We are going to see a lot of such pages now that ajax has a lot of popularity. Think about an 'ajaxified' shopping cart. You know - the ones where you can drag the items into the cart and stuff.

This will hold the ID and quantity of all the purchased items in a javascript array - when the user clicks the 'Checkout' button, this array will be send to the server side.

For such cases, a method for sending an array to the server side is needed - my method will work great in such cases.