Live Search in codeigniter and ajax.
Your js code:-
<script type="text/javascript">
$(document).ready(function(){
$("#sid").keyup(function()
{
$.ajax({
type: "GET",
url: '<?php echo base_url();?>fee/view_ajax',
data: {textbox: $("#sid").val()},
dataType: "text",
cache:false,
success:
function(data){
$('#student').html(data); //as a debugging message.
}
});// you have missed this bracket
return false;
});
});
</script>
your view code:
<input type="text" name="sid" id="sid" placeholder="Enter student ID"class="form-control">
<?php echo base_url();?>fee/view_ajax:- this is your controller you can perform all the operation what you want here.
Your js code:-
<script type="text/javascript">
$(document).ready(function(){
$("#sid").keyup(function()
{
$.ajax({
type: "GET",
url: '<?php echo base_url();?>fee/view_ajax',
data: {textbox: $("#sid").val()},
dataType: "text",
cache:false,
success:
function(data){
$('#student').html(data); //as a debugging message.
}
});// you have missed this bracket
return false;
});
});
</script>
your view code:
<input type="text" name="sid" id="sid" placeholder="Enter student ID"class="form-control">
<?php echo base_url();?>fee/view_ajax:- this is your controller you can perform all the operation what you want here.
No comments:
Post a Comment