<script type="text/javascript">
$(window).load(function(){
$(".button_next a ").click(function(){
var cct = $("input[name=syncrypts]").val();
$.ajax({
url:"<?php echo base_url(); ?>index.php?customer/product/import", //Server script to process data
type: "POST",
data: { 'csrf_token_name': cct },
error: function (err) {
console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
},
success: function(response){
alert("ok");
}
});
});
});
</script>
<?php echo form_open(base_url() . 'index.php?customer/product/import', array(
'enctype' => 'multipart/form-data',
'class' => 'uk-form-stacked',
));
?>
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>">
<?php echo form_close() ?>
代码不起作用。我同样有500个内部服务器错误。为什么?我在config.php中启用了csrf。我读的帖子是http://aymsystems.com/ajax-csrf-protection-codeigniter-20