Can't get a positive trigger - please help

I’m using the following after submitting variables to a contact form.


// Success
success: function (html) {                   
   if (html==1) {        
      // Loading icon
      $('.loading').fadeOut('slow');                                
      //show the success message
      $('.success-message').slideDown('slow');                                                
      // Disable send button
      $('#send').attr('disabled',true);                       
   } else {    
      $('.loading').fadeOut('slow')    alert('Sorry, unexpected error. Please try again later.');                   
   }
}         

After successfully sending the email though, I cant seem to trigger the success. I keep getting the “Sorry, unexpected error. Please try again” message even though the email sends. On the other end, I’ve got:


if(!$mail->Send()) {
   echo "Your message could not be sent.";        
   echo "Mailer Error: " . $mail->ErrorInfo;        
   exit;    
} else {
   return 1;    
}

What in the world am I doing wrong? I’ve been messing with this for hours!!!

If you try

// Success
success: function (html) {
alert(html); // for debugging only
   if (html==1) {
      // Loading icon
      $('.loading').fadeOut('slow');
      //show the success message
      $('.success-message').slideDown('slow');
      // Disable send button
      $('#send').attr('disabled',true);
   } else {
      $('.loading').fadeOut('slow')    alert('Sorry, unexpected error. Please try again later.');
   }
} 

Do you get a “1”?

No… that’s whats killing me.

You need to [fphp]echo[/fphp] the value 1, not return it.
(returning it doesn’t do anything)

What does
$mail->Send()
look like? In particular, what does it return? i.e. Instead of conditionally testing it that way, use a comparative “== what I want”