> Do you read this?
> http://php.net/manual/en/ref.json.php
> On 12/26/06, sridhar panneerselavm < sridhar5@gmail.com> wrote:
> > hi all,
> > i'm going to work in json concept.. can any one help in providing
> > communication between json and php.. And passing raw data from html thru
> > json to php and fetching the details from php
> --
> Sem mais para o momento,
> Rodrigo Souza
> --------------------------------------------------------------------------- -----
> :: Rodrigo Souza dos Santos
> :: Curitiba - Paran - Brasil
> :: rodrigosouzadossan@gmail.com
> --------------------------------------------------------------------------- -----
i'm going to work in json concept.. can any one help in providing
> > > communication between json and php.. And passing raw data from html thru
> > > json to php and fetching the details from php
the concept is easy.. ..it's all about letting your client side scripts
communicate with your server side scripts using only one language , JSON.
what you do here is to use the frameworks, JSON.js for the client side, and
json.php for the server side. These two can be downloaded from the
json.orgwebsite.
To go about doing this, I'll give you a simple example..
For example you have an object in your client side that you want to pass to
the server side. What you do for this is envoke something like this...
--->first you must create an object (like the example below)
myobj = {};
myobj.param1 = 'hello' ;
myobj.param2 = 'world'
-----> this converts the object to json string which is then ready to pass
to the server
var strToPass = JSON.stringify(myobj);
after this, you can now pass 'strToPass' variable by any means you want. My
favorite is using AJAX , but there's also othe means for this.
Now, on you server side, what you will be accepting is the JSON string. in
order for you to convert it back to an object, you must envoke something
like this..
$theString = $_GET['strToPass'];
$anOjbect = json->decode($theString);
----> at this point you can now manipulate the object as it is . for example
...
$anObject->param1 // <-------- this will return the string "hello"
I hope this helps..there is more to this that what it seems, but this is the
basic idea or concept of the whole thing
--
REGISTERED LINUX USER # 393260
there are 10 types of people in the world, those who understand binary and
those who don't