php - ajax data insert problem with CodeIgniter
Solution:
Try Changing your onclick selector to your submit button id.
Answer
Solution:
I have found the issue. The problem was occurring because I set the whole form as an event listener for the insert operation. I needed to use submit instead of click in the
line $("body").on("click", "#createCarModel", function(e) {. So, I have changed it to $("body").on("submit", "#createCarModel", function(e) {. Then the problem stopped happening.
Thanks to all who tried to help me.
Source