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'] ==
    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</
            return $rc = 1;
           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 addToFavorite(quizSeq)
  new Ajax.Request('/my/user-quizzes',
      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 
For more options, visit this group at 

Reply via email to