I've a JS file with function named graph_poids2, this function has an argument named dayr:
File graph.js:
$(function graph_poids2(dayr) {
alert(dayr);
chaine1='../graph/data_today_poids2.php?day=';
alert(chaine1.concat(dayr));
$.getJSON(chaine1.concat(dayr), function (data) { // on récupère les data du json.
etc..
}
In my Main PHP file and before exisiting an argument in JS function graph_poids2, I called the JS fuction like that:
<script src="../graph/graph.js"></script>
BUT now how to do with the JS argument? I've modified the PHP file like that, but it's not working :
<script type="text/javascript"> var dayr='<?php echo "2017-10-31"; ?>'; </script>
<script type="text/javascript"> graph_poids2(dayr); </script>
<script src="../graph/graph_today_poids2.js"></script>
How to do , i've tried many things and looked on the web but nothing help me... Any ideas , please?