javascript
1$(document).on('click.closeModal', '.button2', function (){ 2251 target2 = document.getElementById("ques3").value; 3252 target = document.getElementById("output"); 4253 if(target2.match(/hoge/)){ 5254 var pre ="nice answer!</p><br/><br><br>"; 6255 target.innerHTML = pre; 7256 $.get('show.php', { 8257 name:$('#ques3').val() 9258 }, function(data){ 10259 $('#result2').html(data.message + "次の問題へ進む"); 11260 }); 12261 }
上記のソースコードでshow.phpを呼び出すと、show.phpのmysqlの値を更新するコードが動きません。$.getを使った方法ではできないのでしょうか。
show.php
php
1 1 <?php 2 2 $value ='<a href="moge.php">'; 3 3 4 4 $rs=array( 5 5 "message" => $value 6 6 ); 7 7 8 8 header('Content-Type: application/json; charset=utf-8'); 9 9 echo json_encode($rs); 10 10 $ta = new TableAccess; 11 11 $current_status = $ta->statusCheck(); 12 12 if(isset($current_status[2]) && $current_status[2] == 0){ 13 13 $yuu = $ta->updateStatus(); 14 14 $yuu = $ta->updatePoint(); 15 15 16 16 }
≪追記≫
php
110 $ta = new TableAccess; 2 11 $current_status = $ta->statusCheck(); 3 12 if(isset($current_status[2]) && $current_status[2] == 0){ 4 13 $yuu = $ta->updateStatus(); 5 14 $yuu = $ta->updatePoint();
上の部分が動いてないので、updatePoint()で動作するupdate文が走ってないということです。ifの判定がtrueになることは確認がとれています。
回答1件
あなたの回答
tips
プレビュー