It appears from the original post that the error is

Unexpected g encountered

In your code you have

echo "gyanprakash"

if $_GET['getOrder'] is set.

So, is $_GET['getOrder'] set? if so, you will get the error as the
response will be gyanprakash (NOT JSON encoded).


--- In [email protected], "Kyle" <[EMAIL PROTECTED]> wrote:
>
> Is the php script that is returning the json data live somewhere on
> the web? Can you give me a url that I could ping that will return the
> json data?
> 
> Thanks,
> 
> Kyle
> 
> 
> 
> 
> 
> 
> 
> --- In [email protected], GYANPRAKASH PANDEY
> <gyanprakash_108@> wrote:
> >
> > Dear Kyle,
> > 
> > I did not get the error. Here is my php code;
> > <?
> > class Order
> > {
> >     public $id;
> >     public $d_date;
> >     public $name;
> >     
> > }
> > 
> > 
> > if(isset($_GET['getOrder']))
> > {
> >     $p = new Order();
> >     $p->id= '1';
> >     $p->d_date= '02-03-2008';
> >     $p->name = 'Gyanprakash Pandey';
> >     
> >     echo "gyanprakash";
> >     echo ($p);
> >     echo "gyan";
> > }
> > else
> > {
> >     $p = new Order();
> >     $p->id= '1';
> >     $p->d_date= '02-03-2008';
> >     $p->name = 'Gyanprakash Pandey';
> >     
> >     
> >     echo json_encode($p);
> > 
> > 
> > ?>
> > 
> > Out put of json encoded data is :
> > {"id":"1","d_date":"02-03-2008","name":"Gyanprakash Pandey"}
> > 
> > Action script function i used to decode is :
> > 
> > var rawData:String= event.result.toString();
> >                 var orders:Object= (JSON.decode(rawData)
> as Object);
> > myText.text= orders.id + orders.d_date + orders.name;
> >                 Alert.show("Data transmitted
successfully");
> > 
> > 
> > 
> > Still i'm getting the same error.
> > 
> > Can you please find out the exact error!!!!! It'll be a great help.
> > 
> > thank you very much,
> > 
> > Regards,
> > Gyanprakash Pandey
> > 
> > --- On Tue, 7/10/08, Kyle <ktyacke@> wrote:
> > From: Kyle <ktyacke@>
> > Subject: [flexcoders] Re: Action script 3 JSON
> > To: [email protected]
> > Date: Tuesday, 7 October, 2008, 12:06 AM
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >     
> >             
> > 
> > If you can't find the error, post the json output that is causing the
> > 
> > error to be thrown (the json encoded data that is being returned from
> > 
> > your php script), as well as the AS3 code that you wrote to decode the
> > 
> > json data here and I can take a look at it for you. However, like
> > 
> > Haykel said, more often than not this type of error is caused by a
> > 
> > simple syntax error in your json return.
> > 
> > 
> > 
> > -Kyle
> > 
> > 
> > 
> > --- In [EMAIL PROTECTED] ups.com, "Haykel BEN JEMIA" <haykelbj@ .>
> > 
> > wrote:
> > 
> > >
> > 
> > > Seems that you have a syntax error in the JSON string. Inspect its
> > 
> > content
> > 
> > > before sending it to the JSON decoder.
> > 
> > > 
> > 
> > > On Sat, Oct 4, 2008 at 2:35 PM, GYANPRAKASH PANDEY <
> > 
> > > gyanprakash_ 108@> wrote:
> > 
> > > 
> > 
> > > >   Dear all,
> > 
> > > >
> > 
> > > > I'm using JSON and php for back end data transfer in flex. But,
> > 
> > i'm getting
> > 
> > > > following error:
> > 
> > > > Error: Unexpected g encountered
> > 
> > > >     at com.adobe.serializa tion.json: :JSONTokenizer/
parseError( )
> > 
> > > >     at com.adobe.serializa tion.json: :JSONTokenizer/
> getNextToken( )
> > 
> > > >     at com.adobe.serializa tion.json: :JSONDecoder/ ::nextToken( )
> > 
> > > >     at com.adobe.serializa tion.json: :JSONDecoder$ iinit()
> > 
> > > >     at com.adobe.serializa tion.json: :JSON$/decode( )
> > 
> > > >     at adminPage/handlePla inJSON()
> > 
> > > >     at adminPage/__ pendingOrderRpc_ result()
> > 
> > > >     at
> > 
> > > >
> > 
> > flash.events: :EventDispatcher /flash.events: EventDispatcher:
> :dispatchEventFu nction()
> > 
> > > >     at flash.events: :EventDispatcher /dispatchEvent( )
> > 
> > > >     at mx.rpc.http. mxml::HTTPServic e/
> > 
> > > >
> > 
> > http://www.adobe. com/2006/ flex/mx/internal ::dispatchRpcEve
> nt()<http://www.adobe. com/2006/ flex/mx/internal ::dispatchRpcEve
> nt%28%29>
> > 
> > > >     at mx.rpc::AbstractInv oker/
> > 
> > > >
> > 
> > http://www.adobe. com/2006/ flex/mx/internal
> ::resultHandler()<http://www.adobe. com/2006/ flex/mx/internal
> ::resultHandler% 28%29>
> > 
> > > >     at mx.rpc::Responder/ result()
> > 
> > > >     at mx.rpc::AsyncReques t/acknowledge( )
> > 
> > > >     at ::DirectHTTPMessage Responder/ completeHandler( )
> > 
> > > >     at
> > 
> > > >
> > 
> > flash.events: :EventDispatcher /flash.events: EventDispatcher:
> :dispatchEventFu nction()
> > 
> > > >     at flash.events: :EventDispatcher /dispatchEvent( )
> > 
> > > >     at flash.net::URLLoade r/flash.net: URLLoader: :onComplete( )
> > 
> > > >
> > 
> > > >
> > 
> > > > Can u please help me out in this case..
> > 
> > > >
> > 
> > > > Thanx alot in advance..
> > 
> > > >
> > 
> > > > Regards,
> > 
> > > > Gyanprakash Pandey
> > 
> > > >
> > 
> > > >
> > 
> > > > ------------ --------- ---------
> > 
> > > > Unlimited freedom, unlimited storage. Get it
> > 
> > now<http://in.rd. yahoo.com/ tagline_mail_ 2/*http:/ /help.yahoo.
> com/l/in/ yahoo/mail/ yahoomail/ tools/tools- 08.html/>
> > 
> > > > 
> > 
> > > >
> > 
> > > 
> > 
> > > 
> > 
> > > 
> > 
> > > -- 
> > 
> > > Haykel Ben Jemia
> > 
> > > 
> > 
> > > Allmas
> > 
> > > Web & RIA Development
> > 
> > > http://www.allmas- tn.com
> > 
> > >
> > 
> > 
> > 
> > 
> >       
> > 
> >     
> >     
> >     
> >      
> >     
> >     
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >     
> > 
> > 
> >     
> >     
> > 
> > 
> >       Add more friends to your messenger and enjoy! Go to
> http://messenger.yahoo.com/invite/
> >
>


Reply via email to