如何从厚框jquery检索一个值到调用厚框的PHP文件?..这个厚箱子在给人提示。所以我需要根据 jquery 函数内部是否发生了什么事情来更新数据库。那么我该怎么做呢?
当你的jQuery触发时,你的PHP脚本已经完成,但你可以再次调用它,或者使用ajax调用一个单独的php文件:
$.ajax({
type: "GET",
url: "some.php",
data: { name: "John", location: "Boston" }
})
和一些里面.php :
<?php
$this_is_the_name = $_GET['name'];
$this_is_the_loc = $_GET['location'];
//add these to database or whatever
?>
您可能希望采取一些保护措施来阻止SQL注入攻击 - 任何人都可以将任何数据推送到他们喜欢的脚本中。