Answer the question
In order to leave comments, you need to log in
[Solved] CodeIgniter and ajax-post request
Khabrovchane, help me figure it out.
There is a simple form from where information should be sent by ajax.
I try $.get():
$.get('registration/check/', 's=3', function(html) {
   alert('1');
});
$.post('registration/check/', 's=3', function(html) {
   alert('1');
});
Answer the question
In order to leave comments, you need to log in
Log show what gives?
Also, CodeIgniter is usually configured to cut off GET requests in reverse.
I would write the URI with the root - '/registration/check'
And $.post in JQuery really has the format that the second parameter is not a string, but an object.
And what does it give out?
$.ajax({
type: 'POST',
url: '/registration/check',
data: {s:3}
});
</script>
Another idea: some frameworks (for example, symfony (as far as I know)), if you send post instead of get (or vice versa), it gives 404, not 405 or 406. Maybe something similar in CI?
another stupid idea, and if so:
$.post('registration/check/', {s: "3" }, function(html) {
alert('1');
});
Can anyone send the working .htaccess (the one at the root) and configs to the mail? I will be very grateful. (I'll write soap in a personal.)
Reinstalled CodeIgniter (v2.0.0), nothing changed. The most interesting thing is that the config seems to be ignored. Change $config['log_threshold'] = 4; and $config['allow_get_array'] = FALSE; doesn't affect anything.
Thank you all for your attention, the reason was found - $config['csrf_protection'] = true was included in the config. Figured it out by going through input.class and commenting out $this->_sanitize_globals() first. In the method code, there was a reference just to csrf. True, now it is not clear how to send a post with csrf enabled, but this is already a matter of time;)
Thank you all!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question