Problem with passing values to bootstrap modal window |
I am just start creating a database update system with a bootstrap modal window. I am using ajax to populate the modal form fields but not getting any value. Please review the code and help me to figure out the error.
HTML Code Code: <!-- Modal --> My Controller PHP Code: public function fetch_by_id(){ And Here is the Modal associated with the controller. PHP Code: public function fetch_by_id(){ Here is the ajax code Code: $(document).on('click', '.editBtn', function(){ I am just able to popup the modal window but not getting any value
I do not recommend having two functions/methods with the same name, your just asking for trouble.
Rename one of them to a different name. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
The action of your form clearly points to a method named quotation, but the name of the method in your controller is fetch_by_id. So unless you have some magic routing that we're not aware of, that's your problem.
(02-06-2019, 10:47 AM)skunkbad Wrote: The action of your form clearly points to a method named quotation, but the name of the method in your controller is fetch_by_id. So unless you have some magic routing that we're not aware of, that's your problem.@skunkbad please check again, i have forgot to include the ajax (02-06-2019, 11:45 AM)shamiul72 Wrote:(02-06-2019, 10:47 AM)skunkbad Wrote: The action of your form clearly points to a method named quotation, but the name of the method in your controller is fetch_by_id. So unless you have some magic routing that we're not aware of, that's your problem.@skunkbad please check again, i have forgot to include the ajax You must specify a content-type header for JSON: PHP Code: header('Content-Type: application/json'); (02-06-2019, 01:12 PM)skunkbad Wrote:No Luck still facing the empty fields(02-06-2019, 11:45 AM)shamiul72 Wrote:(02-06-2019, 10:47 AM)skunkbad Wrote: The action of your form clearly points to a method named quotation, but the name of the method in your controller is fetch_by_id. So unless you have some magic routing that we're not aware of, that's your problem.@skunkbad please check again, i have forgot to include the ajax ![]()
Here is an example on how to do it in CodeIgniter with Ajax.
View data in a Bootstrap modal using Ajax, jQuery and PHP What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Here is an example.
jQuery AJAX Example What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |