我想发送'ID'到JS函数然后再从JS函数发送相同的ID到PHP函数.请告诉我我的代码有什么问题!
<script type="text/javascript">
function deleteclient(ID){ //I receive the ID correctly until now!
var x = "<?php deleteclient11('ID');?>";
return false;
}
</script>
<?php
function deleteclient11($x)
{
echo "$x";
}
?>
Run Code Online (Sandbox Code Playgroud) 我不知道如何在我的问题中使用ajax:我在php(assign)中有一个函数更新数据库中的临时表,我想当用户用户点击一个按钮(javascript中定义的反馈函数)这个函数(分配)跑,我该怎么办?
<script>
function feedback(){
var boxes = document.getElementsByClassName('box');
for(var j = 0; j < boxes.length; j++){
if(boxes[j].checked) {
assign(1);
}
else{
assign(0);
}
}
}
</script>
<?php
$con = mysql_connect("localhost", "root", "")
or die(mysql_error());
if (!$con) {
die('Could not connect to MySQL: ' . mysql_error());
}
mysql_select_db("project", $con)
or die(mysql_error());
$result = mysql_query("select * from words");
echo "<table border='1'>
<tr>
<th>word</th>
<th>meaning</th>
<th>checking</th>
</tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['word'] . "</td>";
$idd= $row['id'] ;
echo …Run Code Online (Sandbox Code Playgroud)