I have made the array $latent_weights_array
and I would like when I puss the button 'save' to run a php script via ajax passing the are as $_GET variable.
in PHP
<?php
echo "<input type='button' class='btn'
onclick='ajaxWeight(".json_encode($latent_weights_array).")' value='Save'/>";
?>
in javascript
function ajaxWeight(latentweights){
// trim code here
var queryString = "?latentweights=" + latentweights;
ajaxRequest.open("GET", "031instsql.php" +
queryString, true);
ajaxRequest.send(null);
}
in 031instsql.php
<?php
if (isset($_GET['latentweights'])){
echo $_GET['latentweights'];
$kati=array();
$kati=json_decode($_GET['latentweights'],true);
}
?>
1.Why doesn't seem to work? 2.What does need to be done here?