私は配列を作成しました$latent_weights_array
。「保存」ボタンを押して ajax 経由で PHP スクリプトを実行し、その配列を $_GET 変数として渡したいと思います。
PHPで
<?php
echo "<input type='button' class='btn'
onclick='ajaxWeight(".json_encode($latent_weights_array).")' value='Save'/>";
?>
JavaScriptで
function ajaxWeight(latentweights){
// trim code here
var queryString = "?latentweights=" + latentweights;
ajaxRequest.open("GET", "031instsql.php" +
queryString, true);
ajaxRequest.send(null);
}
031instsql.php で
<?php
if (isset($_GET['latentweights'])){
echo $_GET['latentweights'];
$kati=array();
$kati=json_decode($_GET['latentweights'],true);
}
?>
1.どうしてうまくいかないの?2. ここで何をする必要がありますか?