我在我的应用程序中使用了Ajax。以前它工作得很好,检查过很多次。现在不行了。在这段代码中我没有改变任何东西。
我检查了URL路径,还检查了Jquery事件。
它没有显示控制台日志中的任何错误。
$(".submit").click(function(event) {
event.preventDefault();
var month = $("#month").val();
var zone = $("#zone").val();
$.ajax({
type: 'POST',
url: '<?php echo base_url().'index.php/ContMain/generate'; ?>',
dataType: 'json',
data: {month: month, zone: zone},
success: function(res) {
alert(res);
}
});
});发布于 2018-05-14 06:37:01

<script>
$.ajax({
type: 'POST',
url: "<?php echo base_url().'index.php/ContMain/generate'; ?>",
dataType: 'json ',
data: {
month: month,
zone: zone
},
success: function(res) {
console.log('success', res);
},
error: function(err) {
console.log('error', err);
}
);
</script>
https://stackoverflow.com/questions/50324129
复制相似问题