[Catalyst] Catalyst-Ajax-Mochikit - followed tute but am stuck. Cannot show values in view(webpage)

kakimoto at tpg.com.au kakimoto at tpg.com.au
Mon Apr 13 15:48:13 GMT 2009


hello, Gordon :)


 thank you for your response :) 
i have tried what you recommended me and yes, it works just fine.

thank you, everybody!


K. akimoto



Quoting Gordon Yeong <anexiole at gmail.com>:

> hmmm
>  Haven't done much mochikit but if you're wantign to just update a
> single
> element, consider
> using a DIV tag element in the html file and from the javascript file
> you
> have made,
> update the element (based on the ID assigned to the DIV tag element
> earlier)
> ?
> 
> 
> Taking your code into consideration, in your javascript file,
> just add this function,
> 
> 
> ********************* Start ******************
> 
> function updatepage(str)
> {
>     document.getElementById("price").innerHTML = str;
> }
> 
> ********************* End ******************
> 
> and where the request is successful, just make a call to it :
> 
> 
> ********************* Start ******************
>                 //Checking to see we have a successful response in
> our
> returned data
>                 if (resp.status == 'Successful')
>                 {
>                     log('the Response has status of successful...');
>                    log('mokkie Response has status of
> successful...');
>                     log(resp.data.price);
> *                    updatepage(resp.data.price);    <---- Over here
> :)*
>                 }
>                 else
>                 {
>                     log('Response has status of NON successful');
> 
>                     //calling our partial function
>                     u_message(resp.status);
> 
>                     //getting error reason and txt and updating user
>                     for (i in resp.error)
>                     {
>                         log('Error is:',i);
>                         log('Reason is:',resp.error[i]);
>                         u_error(i+': '+resp.error.i);
>                     }
>                 }
> 
> ********************* End ******************
> 
> Hope it helps:)
> 
> 
> Regards,
> Gordon Yeong
> 
> 
> 2009/4/13 <kakimoto at tpg.com.au>
> 
> > hello, Peter,
> >
> >  Good evening. Thank you for the response.
> >
> > Yeah, "log(resp.data.price);" prints out the value which  I was
> expecting.
> >  Hence,  I was expecting the line, "p_txt =
> P({'style':'display:none'},
> > resp.data.price); "
> > to have worked.
> >  alas, your recommendation of "p_txt = P({'style':'display:none'},
> > resp.data.price.value);" failed too :(
> >
> >
> >  anyone?? thank you:)
> >
> >
> >
> > Quoting Peter Flanigan <pjf at roxsoft.co.uk>:
> >
> > > kakimoto at tpg.com.au wrote:
> > >
> > > > How do I actually get the value (which is the 'price' attribute
> to
> > > display)?
> > > > Point of problem: addCallBack method in my javascript file.
> > >
> > > >  //Creating a callback on success to process our json response
> > > >         d.addCallback
> > > >         (
> > > >             function (req)
> > > >             {
> > >
> > > >                     //elements consult mochikit docs for full
> > > details
> > > >                     var td_price = TD(null,
> > > resp.data.price.value);
> > >
> > > > // Im stuck here!!! Don't know why the freakin' value won't
> show
> > > :(
> > > >
> > > >                     p_txt = P({'style':'display:none'},
> > > resp.data.price);
> > > >                     replaceChildNodes(price, [p_txt]);
> > >
> > > Am not familiar with Mochikit, but from context should that be
> > >
> > > p_txt = P({'style':'display:none'}, resp.data.price.value);
> > >                                                     ^^^^^^^
> > >
> > > --
> > >
> > > Regards
> > >
> > > _______________________________________________
> > > List: Catalyst at lists.scsys.co.uk
> > > Listinfo:
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > > Searchable archive:
> > > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> > > Dev site: http://dev.catalyst.perl.org/
> > >
> > >
> > >
> >
> >
> >
> >
> > _______________________________________________
> > List: Catalyst at lists.scsys.co.uk
> > Listinfo:
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive:
> > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> > Dev site: http://dev.catalyst.perl.org/
> >
> 






More information about the Catalyst mailing list