I am trying to pass the for loop iteration index "i" into a php code that is present inside the javascript loop.
I tried to use ajax call with a post type and then call $_POST['.....']; to read the variable value from inside php. I also tried document.write to read javascript variable directly.
for (var ik = 0; ik < count; ik++) {
$.ajax({
type:"POST",
url: "new4.php",
data:"key1=" ik,
success: function(){//do stuff after the AJAX calls successfully completes
}
});
var data = new google.visualization.DataTable();
data.addColumn('string', 'Shift_Type');
data.addColumn('number', 'Value');
data.addRows([//some php code that needs to know the value of ik]);}