I have a working code with this problem by placing the action in the form like this:

<form method="POST" action="<?php echo base_url();?>agency/save_c">

But I wanted to use the ajax function and also I wanted to implement the whole CRUD operation. That's why I used my old working CRUD using MODAL. In this case, I don't want to use the MODAL I only want to use the one-page crud.

I have a fully functional CRUD operation using modal but, I wanted not to use modal instead I want to create a one page CRUD operation which only consumes at least 5 input text. That's why I'm changing a little bit code in my old working CRUD.