Welcome Guest, Not a member yet? Register   Sign In
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, 01:09 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 01:16 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 01:34 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 01:45 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 02:40 PM
Problem jQuery in CI 2.0 - by El Forum - 02-13-2011, 09:29 PM
Problem jQuery in CI 2.0 - by El Forum - 03-01-2011, 02:27 AM
Problem jQuery in CI 2.0 - by El Forum - 07-18-2011, 03:26 AM
Problem jQuery in CI 2.0 - by El Forum - 07-18-2011, 10:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB