我有game.php文件,该文本输入会将三个值发送到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'] ?>)" />
javascript是:
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文件尝试插入或更新接收到的数据:
<?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'";
}
?>
但是什么也没发生,我该如何解决,最好的问候。