weixin_33724046
weixin_33724046
采纳率0%
2020-04-07 18:56 阅读 32

无法从ajax发送帖子数据

I have game.php file have this text input which sending three values to javascript:

<script src="js/jq.js"></script>
<script src="js/main.js"></script>
<input type="text" name="textfield2" id="textfield2" onkeyup="home(this.value,<?php echo $uid ?>,<?php echo $row_g['id'] ?>)" />

the javascript is :

function home(homeex,uid,mid){
$.ajax({
   type: "POST",
   contentType: "application/json; charset=utf-8",
   url: "inuphome.php",
   data: { homeex: homeex, uid: uid, mid: mid },
   success: function (result) {
   }
});
}

inuphome.php file try to insert or update received data :

<?php 
require_once('connections/connect.php');

$homeex=$_POST['homeex'];
$uid=$_POST['uid'];
$mid=$_POST['mid'];

    $exp="SELECT * FROM expects Where uid='$uid' and mid='$mid'";
    $result_ex=mysqli_query($berikane,$exp);
    $row_ex=mysqli_fetch_assoc($result_ex);
    $count = mysqli_num_rows($result_ex);

        if ($count==0){
        $query = "INSERT INTO expects  VALUES ('','$uid','$mid','$homeex','','')";  
        mysqli_query($berikane,$query); 
        }
        else{
        $query = "UPDATE expects SET homeex='$homeex' where uid='$uid' and mid='$mid'";
        }
?>

but nothing happens ,how can i solve this , best regards.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

相关推荐