+ 1

How to get values from database using ajax json in spring security and hibernate

I was tried but I'm in stuck . spring security could be restrect something .. please let me help how can I do

20th Dec 2017, 3:49 PM
JRaj Fx
JRaj Fx - avatar
2 Respuestas
+ 4
For retrieving data using Ajax+jQuery, you must write the following code: <html> <script type="text/javascript" src="jquery-1.3.2.js"> </script> <script type="text/javascript"> $(document).ready(function() { $("#display").click(function() { $.ajax({ //create an ajax request to display.php type: "GET", url: "display.php", dataType: "html", //expect html to be returned success: function(response){ $("#responsecontainer").html(response); //alert(response); } }); }); }); </script> <body> <h3 align="center">Manage Student Details</h3> <table border="1" align="center"> <tr> <td> <input type="button" id="display" value="Display All Data" /> </td> </tr> </table> <div id="responsecontainer" align="center"> </div> </body> </html> For mysqli connection, write this: <?php $con=mysqli_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysqli_error()); } ?> For displaying the data from database, you must write this : <?php include("connection.php"); mysqli_select_db("samples",$con); $result=mysqli_query("select * from student",$con); echo "<table border='1' > <tr> <td align=center> <b>Roll No</b></td> <td align=center><b>Name</b></td> <td align=center><b>Address</b></td> <td align=center><b>Stream</b></td></td> <td align=center><b>Status</b></td>"; while($data = mysqli_fetch_row($result)) { echo "<tr>"; echo "<td align=center>$data[0]</td>"; echo "<td align=center>$data[1]</td>"; echo "<td align=center>$data[2]</td>"; echo "<td align=center>$data[3]</td>"; echo "<td align=center>$data[4]</td>"; echo "</tr>"; } echo "</table>"; ?>
20th Dec 2017, 3:56 PM
James16
James16 - avatar
0
thx for ur rply .but I want java
20th Dec 2017, 3:57 PM
JRaj Fx
JRaj Fx - avatar