The below code is in my javascript/jquery script, but for some reason Firebug tells me I have a “syntax error: var fbbirthday = ;\n“.
var fbbirthday = <?php echo $fb_day_of_birth; ?>;
var fbbirthmonth = <?php echo $fb_month_of_birth; ?>;
var selectbirthyear = $('#ad_engine_birth_date_year').val();
Meanwhile, the browser actually shows the following (because the php variables $fb_day_of_birth and $fb_month_of_birth are empty when the user isn’t logged into facebook).
var fbbirthday = ;
var fbbirthmonth = ;
var selectbirthyear = $('#ad_engine_birth_date_year').val();
I’ve spent a while trying to figure out where the \n that firebug finds is coming from. Any help would be appreciated!
This statement is illegal as the right hand side of the assignment is missing:
This is probably due to
$fb_day_of_birththat is an empty string. You should check that and use an alternative value like:Or better use
json_encode: