0

i am trying to pass an array of php to js for use with beforeshowday function in datepicker. any suggestions?

Comments
  • 1
    Don't know what framework you're using or are you sending the data via ajax or just on load but usually json does the job nicely
  • 0
    i am using jquery. and i use json but not doing correctly the format
  • 3
    php - echo json_encode(array);

    Ajax success - console.log(JSON.stringify(data));
  • 1
    I've seen people echo out php data structures into the document inside of script tags so the js runs right away.
    <?php echo '"<script>var stuff = $stuff <\script>";
Add Comment