我在AJAX新的要发送的这里AJAX页面上的ID 2是我的代码
<a href="#" id="<?php echo $st_rows4['module_id'];?>" class="edit3">Click Here</a>
<script>
$(document).ready(function() {
$(".edit3").click(function() {
var moduleID = $(this).attr('id');
var studentID = $_POST['studentAssignID']; //Problem is Here
$.ajax({
type: "POST",
url: 'assign-assignment-ajax.php',
data: "moduleID="+moduleID+"&studentID="+studentID,
success: function(data)
{
$("#editform2").html(data);
$("#editform2").show('slow');
}
});
});
});
我通过点击获取模块ID在href上,虽然我也想要学生证,但是我做错了哪一部分?在隐藏字段
var studentID = "<?php echo $_POST['studentAssignID']; ?>";
你不能在JavaScript中访问php变量$ _POST,像这样,studentAssignID从哪里来?它是来自数据库请求还是在完成后需要这个? – swidmann
你还没有在php中包装'$ _POST ['studentAssignID'];',你也没有像以前那样回应。 – Epodax
向我们展示您的输入表单 –