• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem jQuery in CI 2.0

#9
[eluser]kaege[/eluser]
I don't understand about csrf_token_name because I use CI 2.0 and, as far as I know, CI 2.0 made no such cookie. The cookie was csrf_test_name. Here's an example from my work:

jQuery
Code:
echo "$.post('".site_url()."/siplhp/welcome', 'name=michael&csrf;_test_name=".$this->input->cookie('csrf_test_name')."', function(data) {alert(data)});";

CI
Code:
if ($this->input->is_ajax_request())
{
    // If it's a AJAX request
    echo "Your name is '".$this->input->post('name')."'";
}
else
{
    // Otherwise...
}

Remember, CodeIgniter (CSRF in this case) always expect $this->input->post('csrf_test_name') in every POST data.


Messages In This Thread
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 02:09 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 02:16 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 02:34 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 02:45 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 03:40 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 10:29 PM
Problem jQuery in CI 2.0 - by El Forum - 03-01-2011, 03:27 AM
Problem jQuery in CI 2.0 - by El Forum - 07-18-2011, 04:26 AM
Problem jQuery in CI 2.0 - by El Forum - 07-18-2011, 11:51 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.