Skip to content

Instantly share code, notes, and snippets.

@yuceltoluyag
Created June 16, 2019 11:53
Show Gist options
  • Save yuceltoluyag/dcf5eadd7ed7602372f0ede1219284e7 to your computer and use it in GitHub Desktop.
Save yuceltoluyag/dcf5eadd7ed7602372f0ede1219284e7 to your computer and use it in GitHub Desktop.
AJAX + CSRF Protection in Codeigniter
AJAX işlemlerinde CSRF hatası almamanız için HTML temanızda Footer nerede ise </body> öncesine aşağdaki kodu yapıştırın:
<script type="text/javascript">
$.ajaxSetup({
data: {
'<?php echo $this->security->get_csrf_token_name(); ?>': '<?php echo $this->security->get_csrf_hash(); ?>'
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment