Hi HTH, Thanks for the prompt reply .. my issue is solved . But is there a way i can use the existing file of functions so that i dont have to make another file for ajax?
On Mar 15, 10:10 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote: > Hi, > > Write your PHP page to *only* output what you want to receive. So for > instance: > > <?php > echo "only what you want here" > ?> > > Anything you output from PHP will be received by the client-side stuff > (this is a Good Thing[tm]), but that just means you need to make sure > your PHP is returning only what you want it to. > > HTH, > -- > T.J. Crowder > Independent Software Consultant > tj / crowder software / comwww.crowdersoftware.com > > On Mar 15, 10:29 am, Zahid <m.zahidans...@gmail.com> wrote: > > > > > Hi iam new to prototype .My question is that iam having a php file > > helper.php which is having a single functions : > > > function content_body() which returns value according to action > > variable comming with $_GET request. Function is given below > > --------------------------------------------------------------------------- > > --------------------------------------------------------------------------- > > --------------------------------------- > > else if(isset($_GET['action']) && $_GET['action'] == > > 'addtofavorite') > > { > > if(! in_context('seq')) > > { > > echo "<center><span style='color:red'>Please Signup to add a quiz > > to your favorites </span></center>"; > > } > > $quiz_seq = $_GET['quiz_seq']; > > $rc = addtofavorite($quiz_seq); //function defined in helper.phi > > line no 1313 > > if ($rc == 2) > > { > > // echo "<center><span style='color:green'>You have already added > > this quiz to your favorites</span></center>"; > > return $rc = 2; > > } > > if ($rc == 1) > > { > > // echo "<center><span style='color:green'>Added to Favorites</ > > span></center>"; > > return $rc = 1; > > } > > else > > { > > echo "<center><span style='color:red'>Unable to add to favorites > > : > > Please try again</span></center>"; > > } > > } > > --------------------------------------------------------------------------- > > --------------------------------------------------------------------------- > > ------------------------------- > > > Now Iam using below function to get the return value of the above > > function: > > --------------------------------------------------------------------------- > > ------------------------------------------------ > > function addToFavorite(quizSeq) > > { > > new Ajax.Request('/my/user-quizzes', > > { > > method:'get', > > parameters: { action:'addtofavorite', quiz_seq:quizSeq }, > > onSuccess: function(transport){ > > var response = transport.responseText || "no response text"; > > alert("Success! \n\n" + response); > > }, > > onFailure: function(){ > > alert("Please sign up to rate this quiz! \n\n" + response); > > } > > }); > > > } > > > --------------------------------------------------------------------------- > > --------------------------------------------------- > > > But the return value is having all the html code , how can I get only > > the retun value of function. -- 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.