I have a click event under document.ready function like this
<script type= "text/javascript">
$(document).ready(function(){
var roll;
var course_code;
$('#table').on('click', 'button', function(){
var obj = JSON.parse($(this).val());
course_code = obj.course_code;
roll = obj.roll;
$.ajax({
type : "POST",
dataType: "html",
url : "./card.php",
data : {"course_code":course_code,"roll":roll},
success : function(returndata){
$("#modal-body").html(returndata);
}
});
$("#myModal").modal('show');
});
});
</script>
card.php code
<?hph
echo '<pre>';
echo htmlspecialchars(var_dump($_POST));
echo '</pre>';
?>
the output from the card.php is
C:\wamp\www\card.php:3:
array (size=0)
empty
Why i am not been able to send the data to card.php what is the correct solution
如果您的JQuery版本大于1.9.0,则需要在Ajax请求中将TYPE替换为METHOD 。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.