Code from controller:
Code:
if($goodDates) {
$data['start_date'] = $this->mapModel->getStartDate($theUser);
$data['end_date'] = $this->mapModel->getEndDate($theUser);
}
$this->load->view('users/showMap', $data, FALSE);
which gets the variables into the View and I can see the strings when I am building the view
Code:
<?php
if (isset($start_date)){
?>
<p>a miracle <?php echo $start_date ?><br><?php echo $end_date ?> </p>
<?php
}
?>
But, when I try to assign to javascript variable, they are interpreted as numbers, not strings.
Code:
function initMap(){
<?php if ($end_date){ ?>
var theStartDate =<?php echo $start_date ?>;
var theEndDate = <?php echo $end_date ?>;
Above code gets theStartDate as 1993, NOT
2020-02-25, which is how it echos in the View's body section
I have not been able to successfully figure out how to php echo this as a string for use in the js section
Suggestions Welcome.