[Solved] CodeIgniter and ajax post request

0 like 0 dislike
3 views
Habrovany, help to understand.

There is a simple form where ajax'ω must be sent information.
Try $.get():

$.get('registration/check/', 's=3', function(html) {
alert('1');
});

Everything is fine.

Try $.post() with the same parameters:

$.post('registration/check/', 's=3', function(html) {
alert('1');
});

FireBug gets the response 500-error (internal server error).

Anyone encountered this?
by | 3 views

6 Answers

0 like 0 dislike
The logs show, what gives?
As usual CodeIgniter is configured to cut off GET requests to the contrary.
URI I would root wrote — '/registration/check'
And $.post in JQuery, has a really format that the second parameter is not string, but object.
And this is what gives?
\r
$.ajax({ type: 'POST', url: '/registration/check', data: {s:3} }); 
by
0 like 0 dislike
Another idea: some frameworks (e.g., symfony (as far as I know)) if you send post instead of get (or Vice versa) gives a 404, not a 405 or 406. Maybe. something like that?
by
0 like 0 dislike
another stupid idea, and if so:
$.post('registration/check/', {s: "3"}, function(html) {
alert('1');
});
by
0 like 0 dislike
Can anyone throw workers .htaccess (in the root) and configs for the mail? I would greatly appreciate. (Write in a personal soap.)
by
0 like 0 dislike
Reset CodeIgniter (v2.0.0), nothing has changed. Most interesting is that the config like is ignored. Change $config['log_threshold'] = 4; $config['allow_get_array'] = FALSE; has no effect.
by
0 like 0 dislike
Thank you all for your attention, the reason was — it was enabled in the config $config['csrf_protection'] = true. Found out after going through input.class and sacamento, first, $this->_sanitize_globals(). In the code of a method was a reference just to csrf. However now it is not clear how to send post with csrf enabled, but that's a matter of time;)
\r
Thank you all!
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
asked Mar 21, 2019 by RazoR_Empire
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
32,865 users