As soon as I assign a value to my PHP variable $msg
...
$msg = 'Some message';
... I want to call a JS function like this :
function showSuccess() {
alert('success')
}
Is it possible ?
As soon as I assign a value to my PHP variable $msg
...
$msg = 'Some message';
... I want to call a JS function like this :
function showSuccess() {
alert('success')
}
Is it possible ?
If I understand you correctly, this will be the answer for your question.
$msg = 'some value your are going to assign';
if($msg) //checking $msg variable has some value or not
{
print '<script type="text/javascript">showSuccess()</script>';
/* or */
print '<script type="text/javascript">alert("succeess")</script>';
}