Error "POST" 500 with ajax request. |
I've created a modal register form and when i submit the form i get the following error:
Code: jquery-3.3.1.min.js:2 I've checked the controller and model and i cant find any errors. Any ideas?! Controller Code: public function create_user(){ Model Code: public function register($enc_password){ Ajax function: Code: $('#userRegister').on('submit', function(e){ //Life motto if (sad() == true) { sad().stop(); develop(); }
What does the <form> look like? Additionally, as an aside you want to hash your passwords, not sure if you models handle that though.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
(09-25-2018, 01:40 PM)ignitedcms Wrote: What does the <form> look like? Yes sorry my mistake.. Here... Code: <?php echo form_open('users/create_user', 'class="customForm" id="userRegister"'); ?> I've included some of the inputs.. I've removed //Life motto if (sad() == true) { sad().stop(); develop(); }
Am I assuming you are loading your models in the config file?
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Yes, my guess is something is failing in the controller, strip it down to the bare minimum to make sure it is getting there and passing something back, so remove any model calls.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
You need to find your server's error logs and see what that's saying. 500 errors are notoriously difficult to track down unless you can look at the log file itself. The log should have the exact error you're running into, though.
This is why they tell you to get it working with pure html and php first,
then add the JavaScript Ajax when it is already working. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Yeah but it is a modal so I figured you need ajax.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Well guys the thing was that i was trying to pass a value that was not inserted as a value in inputs. In other words, I was trying to add "username" to the table, while there was not any inputs for username.. I removed it from model and now it works like a charm!
//Life motto if (sad() == true) { sad().stop(); develop(); } |
Welcome Guest, Not a member yet? Register Sign In |