PHP
OOPs
JavaScript
JQuery
Ajax
Codeigniter
Laravel
MySql
Node.js
Tutorials
C
C++
Json
Codeigniter 4
htaccess
wordpress
react.js
Blogs
Fundamental
Python
Search Your Query
×
--- Select Category ---
PHP
OOPs
JavaScript
JQuery
Ajax
Codeigniter
Laravel
MySql
Node.js
Tutorials
Blogs
Fundamental
Python
Most Popular Tutorials
What is Ajax
How Ajax Work in Php
ajax() and load() function
AJAX get() and post() Method
$.ajax() function
Get data using Ajax call
Load div content on button click
Insert Data in mysql Database
Delete Record
Fetch Data from database
User Registration form
ContactUs form
Change Password
ajax search
insert data usign Serialize
Insert Data without serialize function
User Check Availability
Star rating
Pin check availability
Dynamically Add / Remove input fields in PHP with Jquery Ajax
clear form field after submitting form
Loader show / hide
Javascript and Ajax function
Ajax Programs
Success and Failure message
getJSON Function in ajax
Tutorials Menus
What is Ajax
How Ajax Work in Php
ajax() and load() function
AJAX get() and post() Method
$.ajax() function
Get data using Ajax call
Load div content on button click
Insert Data in mysql Database
Delete Record
Fetch Data from database
User Registration form
ContactUs form
Change Password
ajax search
insert data usign Serialize
Insert Data without serialize function
User Check Availability
Star rating
Pin check availability
Dynamically Add / Remove input fields in PHP with Jquery Ajax
clear form field after submitting form
Loader show / hide
Javascript and Ajax function
Ajax Programs
Success and Failure message
getJSON Function in ajax
Share On Facebook
How to load datra on button click using ajax call?
How to load div content on button click using ajax with db.
File name : controller.php
public function showcomments()
{
//$leader_id = $this->uri->segment(3);
$leader_id = $this->input->get('id');
$commentsresult = $this->Auth_model->getcomments_info($leader_id);
$data['commentsdata'] = $commentsresult;
//load the home view
$comment_html = $this->load->view('comments',$data,true);
echo $comment_html;
exit;
}
View Page
File name : view.php
<html>
<head>
</head>
<script type="text/javascript">
$(function(){
$('.btn').click(function(){
var lid = this.id ;
$.ajax({
type:'GET',
data:'id='+lid,
url : '<?php echo base_url();?>home/showcomments',
success:function(result){
//alert(response);
$("#comment_list").html(result);
},
error: function(msg){
alert("error");
}
});
});
});
</script> <body>
<a href="javascript:void(0)" class="btn"
id="<?php echo $row->id; ?>">Show Comments</a>
<div id="comment_list">
</div>
</body>
</html>
File name : comments.php
<table class="table datatable">
<thead>
<tr>
<th>Comments By</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<?php
$kk = count ( $commentsdata );
if($kk > 0){
for($c = 0; $c < $kk; ++ $c) {
?>
<tr>
<td><?php echo $commentsdata[$c]->user_name; ?></td>
<td><?php echo $commentsdata[$c]->comments; ?></td>
</tr>
<?php }
}
else {
?>
<tr>
<td>No Comments</td>
</tr>
<?php }?>
</tbody>
</table>
Share On Facebook
Previous
Next
Trending Tutorials
PHP
100+ Tutorials
PHP OOPs
80+ Tutorial
Codeigniter
100+ Tutorial
Laravel
100+ Tutorials
NODE.JS
100+ Tutorials
Javascript
100+ Tutorials
Download Live Projects
Review & Rating
0.0
/ 5
0
Review
5
(
0
)
4
(
0
)
3
(
0
)
2
(
0
)
1
(
0
)
Write Review Here
Review
Submit Review
×
Submit
Ittutorial
Ittutorial
Most Popular Tutorials
Success and Failure message
Insert Data in mysql Database
Fetch Data from database
Change Password
ajax search
Star rating
What is Ajax
AJAX get() and post() Method
ajax() and load() function
insert data usign Serialize
Delete Record
$.ajax() function
Load div content on button click
User Check Availability
ContactUs form
clear form field after submitting form
Dynamically Add / Remove input fields in PHP with Jquery Ajax
Ajax Programs
User Registration form
Insert Data without serialize function
Important Link
Core php Online Advance Tutorails and video Tutorials.
How to manage Session in php Tutorials.
More .......
upcomming codeigniter and angular js tutorials.
Click here to see More ...
Hello Friend Please Follow & Share Ittutorial.
×
Ittutorial
Please Follow and Share ittutorial.
Ittutorial