Codeigniter Ajax Post 500 Internal Server Error
Contents |
here for a quick overview of the site Help Center Detailed answers to
Jquery Ajax 500 Internal Server Error Codeigniter
any questions you might have Meta Discuss the workings and php ajax codeigniter policies of this site About Us Learn more about Stack Overflow the company Business Learn
Ajax Post 500 Internal Server Error C#
more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow jquery ajax post 500 internal server error asp net Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Getting 500 Internal Server Error with jQuery AJAX and CodeIgniter up vote 0 down vote favorite 1 I'm trying to submit a form (it's a dynamic 500 internal server error php codeigniter form with fields added via jQuery) to CodeIgniter for a db insert. Part of it works, the other part doesn't. Here's the jQuery: function submitForm() { $.ajax({ type: 'POST', url: '/raffle/save/', data: $('#raffle').serialize(), success: function (response) { alert(response); }, error: function() { alert('Failed'); // This is what I get unless I comment out the entry insert } }); } The CI controller: class Raffle extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('raffle_model'); $this->load->library('form_validation'); } public function index() { $data['title'] = 'Create a Raffle'; $this->load->view('header', $data); $this->load->view('raffles/create_view', $data); $this->load->view('raffles/bottombar_view', $data); $this->load->view('footer', $data); } public function save() { foreach($_POST as $k => $v) { if($k == 'entrant' || $k == 'tickets') { foreach ($v as $i => $vector) { $this->form_validation->set_rules('entrant[' . $i . ']', 'Entrant name', 'trim|required|min_length[1]|max_length[100]|xss_clean'); $this->form_validation->set_rules('tickets[' . $i . ']', 'Number of tickets', 'trim|required|max_length[2]|is_natural_no_zero|xss_clean'); } } else { $this->form_validation->set_rules('raffle-name', 'Raffle name', 'trim|required|min_length[4]|max_length[100]|xss_clean'); $this->form_validation->set_rules('winners', 'Number of winners', 'trim|required|max_length[2]|is_natural_no_zero|xss_clean'); } } if($t
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this
Networkerror 500 Internal Server Error In Codeigniter
site About Us Learn more about Stack Overflow the company Business Learn more 500 internal server error codeigniter htaccess about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
Csrf Codeigniter
Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Codeigniter ajax request http://stackoverflow.com/questions/10988851/getting-500-internal-server-error-with-jquery-ajax-and-codeigniter 500 internal server error up vote 0 down vote favorite http://stackoverflow.com/questions/35588302/codeigniter-ajax-request-500-internal-server-error array( 'enctype' => 'multipart/form-data', 'class' => 'uk-form-stacked', )); ?> The code not work. I have equally 500 internal server error. Why? I enabled csrf in the config.php. The post that i read is this http://aymsystems.com/ajax-csrf-protection-codeigniter-20 php jquery ajax codeigniter share|improve this question asked Feb 23 at 21:14 Eliana 771315 1 500 internal server error means you should have error details in your apache or nginx error.log file. Go find it. –jszobody Feb 23 at 21:15 Possible duplicate of Codeigniter csrf token with ajax request (500 internal server error) –AdrienXL Feb 23 at 21:19 See the post mentioned by AdrienXL. stackoverflow.com/questions/25043070/… –jjwdesign Feb 23 at 21:53 works! thank you! but i don't understand why my code not worked.. –Eliana Feb 24 at 20:53 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook. Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and
: 500 Internal server error Ambar Hasbiyatmoko SubscribeSubscribedUnsubscribe8383 Loading... Loading... Working... Add to Want to watch this again later? Sign in to add this video to a playlist. Sign in Share More Report Need to report the video? https://www.youtube.com/watch?v=Q9Hrf01-1oY Sign in to report inappropriate content. Sign in Statistics 2,752 views 4 Like this video? Sign in to make your opinion count. Sign in 5 0 Don't like this video? Sign in to make https://www.webniraj.com/2014/01/12/codeigniter-using-csrf-tokens-to-secure-your-application/ your opinion count. Sign in 1 Loading... Loading... Loading... Rating is available when the video has been rented. This feature is not available right now. Please try again later. Published on Dec 4, 500 internal 2015ci : how to solving 500 internal server error in codeigniter Category People & Blogs License Standard YouTube License Show more Show less Loading... Advertisement Autoplay When autoplay is enabled, a suggested video will automatically play next. Up next CodeIgniter Tutorial 3 - Remove index.php from URL - Duration: 12:15. Anthony David 58,136 views 12:15 How to install Codeigniter and remove index.php from URL - Duration: 10:04. 500 internal server Dharmesh Patel 110 views 10:04 2 (WAMP issues) Server encountered an internal error and was unable to complete request - Duration: 8:37. Make Knowledge Free 12,885 views 8:37 How to Fix WordPress 500 Internal Server Error - Duration: 9:06. RankYa 33,604 views 9:06 16 videos Play all Westlife OriginalKrisKross75 How to Fix wamp internal server error htaccess - Duration: 1:52. ThenisH 4,270 views 1:52 Codeigniter tutorial - Multiple upload with Codeigniter v2.2.6 - Duration: 19:25. Ambar Hasbiyatmoko 228 views 19:25 Internal Server Error (How to fix) - Duration: 1:57. Shuvo Nill 1,590 views 1:57 How to fix the 500 Internal Server Error on LocalHost - Duration: 3:18. HSNYC 19,524 views 3:18 Codeigniter 3 - Ajax Server Side Validation - Duration: 12:20. masaru edogawa 3,510 views 12:20 500 Internal Server Error - How to fix it / adding plugins - Duration: 2:39. Prevádzkar.sk 743 views 2:39 Permanent Fix for remove hss 500 Internal Server Error - Duration: 3:55. walix tajourix 761 views 3:55 How to Fix: Warning: session_start() [function.session-start]: Cannot send session cache limiter - Duration: 2:12. Mukesh Singh 43 views 2:12 How to get rid of 500 - Internal server error. - Duration: 2:45. Ke Kompjuter! 22,991 views 2:45 How
» CodeIgniter: Using CSRF Tokens to Secure Your Application CodeIgniter: Using CSRF Tokens to Secure Your Application 20 Protecting your CodeIgniter application from Cross-site request forgery (CSRF or XSRF) attacks is pretty easy thanks to the built-in support. Once CSRF protection is enabled in the config file, you can use the form helper or custom code to protect your forms and AJAX calls from CSRF. The CodeIgniter framework will automatically protect forms or calls that make POST requests once protection is enabled - here's how to update your application. Enable CSRF Protection To enable CSRF protection in your CodeIgniter application, edit the application/config/config.php file and look for $config['csrf_protection']. Change the setting to TRUE (if it isn't already) to enable protection. If you then test a form or AJAX call in your application, the request will fail showing a generic error: This means that CSRF protection is working, and we now need to update the forms to add a CSRF token to the POST data. Updating forms with CSRF tokens The easiest way to update your forms is to use the Form Helper. Load the form helper manually (in your controller) or add it to the application/config/autoload.php file and call echo form_open('login'); (the first parameter is the form action, and the second parameter is an array of attributes): View the code on Gist. Using form_open() will automatically add in a new field into the form with a randomly generated token used to prevent CSRF. View the code on Gist. If you don't want to use form_open(), you can add it to your form manually with: View the code on Gist. After updating your form, test the code by POSTing some data and the request should now go through as normal. To test it further, edit the value of the CSRF input (e.g. using Chrome), then submit the form again. Changing the CSRF token will result in the above error message as CodeIgniter has detected a CS