Hi,

> ...is
> there any way i can format the output before it get displayed ?

Yes. Instead of Ajax.Updater, use Ajax.Request and then do the update
yourself:

function addToFavorite(quizSeq , userSeq)
{
  new Ajax.Request('/my/user-quizzes/processRequest',
    {
      method:'get',
      parameters: { action:'addtofavorite', quiz_seq:quizSeq ,
user_seq:userSeq},
      onSuccess: function(response) {
        var markup = response.responseText;
        /* ...do any pre-processing you want to 'markup'... */
        $('ajaxresponce').update(markup);
      }
    });
}

It's worth taking an hour or three to read through the Prototype API[1]
[2] front to back. (The unofficial wiki[3] is worth a look, too.) It
only takes about that long, but *wow* does it pay you back in terms of
saving time down the line.

[1] http://api.prototypejs.org (the new API docs)
[2] http://prototypejs.org/api (the old API docs; sadly, still some
stuff in there that isn't in the new ones)
[3] http://proto-scripty.wikidot.com

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com


On Mar 18, 7:11 pm, Zahid <m.zahidans...@gmail.com> wrote:
> thanks to all your answers. I want to intercept the response which is
> coming from the php script before it get displayed to front end. I am
> using the below function ,the php script sends the response like
> "added to favorite"..which get displayed to front end as it is...is
> there any way i can format the output before it get displayed ?
>
> function addToFavorite(quizSeq , userSeq)
> {
>   new Ajax.Updater('ajaxresponce','/my/user-quizzes/processRequest',
>     {
>       method:'get',
>       parameters: { action:'addtofavorite', quiz_seq:quizSeq ,
> user_seq:userSeq}
>     });
>
> }
>
> On Mar 16, 10:42 pm, disccomp <discc...@gmail.com> wrote:
>
>
>
> > You could add logic to the beginning of you php script.
>
> > In this illustration(don't shoot me if it doesn't run OTB) I am
> > assuming the AJAX request will use the default POST method and with a
> > parameter named 'AJAX_action'.
>
> >http://pastie.org/872367

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to