When you add a custom HTML element to a page you have an advanced option to embed php which works.
When you add a custom javascript element to a page that advanced option for PHP does not appear and any embedded php is left as is.
I need to call a javascript function from complex action event and this function needs to access data that is available server side in php.
Even the simple function below fails (but works if the php code is removed).
var formData = <?php echo '\"hello world\"'; ?>;
function calcCourseCost()
{
alert("calcCourseCost called with formData = " + formData);
return 0;
}
Does anyone know how to resolve this or perhaps another way to get the data available to the javascript function
When you add a custom javascript element to a page that advanced option for PHP does not appear and any embedded php is left as is.
I need to call a javascript function from complex action event and this function needs to access data that is available server side in php.
Even the simple function below fails (but works if the php code is removed).
var formData = <?php echo '\"hello world\"'; ?>;
function calcCourseCost()
{
alert("calcCourseCost called with formData = " + formData);
return 0;
}
Does anyone know how to resolve this or perhaps another way to get the data available to the javascript function
You need to login to be able to post a reply.