I have this scipt call:
....
$objResponse->addScriptCall("my_script");
return $objResponse->sendResponse();
This works ok but if I try to send a php mail just before, the script is not called:
...
$send =& $mailer->Send();
$objResponse->addScriptCall("my_script");
return $objResponse->sendResponse();
Why is that happening?
The problem persists even if I replace the email function with a plain:
...
print 'hello';
$objResponse->addScriptCall("my_script");
return $objResponse->sendResponse();
You need to call
error_reporting(0); ini_set('display_errors', 0);at the top of your script.The
$mailer->Send()call is triggering an error, which is being echoed. This is causing a Javascript syntax error which will, as you say, break your Javascript.This is why calling
print "hello";also breaks it, because you then have a random, meaninglesshelloat the top of your Javascript.