This code is runs for submit button...but this is not work for HTML button.
page submit without validating page in case of html button
<html>
<head>
<title>Display Data In Database Using CodeIgniter</title>
<script src="
http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#bus_master").validate({
rules: {
busname: {
required: true
}
}
}
},
messages: {
bustname:"<font color=red size=4>Please
Input Bus stop Name</font>"
}
});
});
function getdata()
{
alert("ok");
var grade_id =1;
$.ajax({
type: "POST",
url: "<?php echo base_url();
?>index.php/update_ctrl/show_using_jquery/"+grade_id,
data: { },
success: function(result)
{
$.each(result, function(i,element){
alert(element.Student_Name);
});
}
});
}
</script>
</head>
<body>
<div id="container">
<div id="wrapper">
<h1>Display Data In Database Using CodeIgniter
</h1><hr/><br>
<div id="detail">
<!-- Fetching All Details of Selected Student From Database And
Showing In a Form -->
<?php echo validation_errors(); ?>
<form method="post" action=""
name="bus_master">
<label id="hide">ID :</label>
<input type="text" id=""
name="busname" ><br><br>
<label>Name :</label>
<left>
<input type="button" id="btnin"
name="dsubmit" value="Display"
onClick="getdata();">
<left>
</form>
</div>
</div>
</div>
</body>
</html>