How to get JSON data in table - Codeigniter |
[url=https://stackoverflow.com/questions/52217079/how-to-get-json-data-in-table-codeigniter/52217327?noredirect=1#][/url]
Hello I want to display data on click without refresh page in codeigniter, I got data in JSON but how to display in table view, so here is my code so please help me. Here Is My Controller: Code: public function get_event_date() { Here Is My Model: Code: public function getallevent($start_event,$end_event) Code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Use JSON.parse(data) in the success part of AJAX:
Code: records = JSON.parse(data); A few remarks on php styling. If you mix php and html, the alternative syntax for control structures can be very helpful: PHP Code: <?php foreach($records as $record) : ?> In your page, you have the <tbody> inside the foreach structure. That's not necessary. Place it before the foreach, and the </tbody> after it. In stead of "<?php echo" you can use "<?=" in views. Makes it more compact and better to read.
(09-07-2018, 03:36 AM)Wouter60 Wrote: Use JSON.parse(data) in the success part of AJAX:
(09-07-2018, 03:53 AM)jaydevvara Wrote:(09-07-2018, 03:36 AM)Wouter60 Wrote: Use JSON.parse(data) in the success part of AJAX: i already added json in success part but i did not get in response in success part |
Welcome Guest, Not a member yet? Register Sign In |