Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- employeeTable.find(".command-edit").on("click", function(event)
- {
- var eid = $(this).data("row-id");
- // At this point i can get the alert values o.k.
- alert("You pressed edit on row: " + $(this).data("row-id"));
- alert("You pressed edit on row: "+""+eid);
- //but here is the issue
- $.ajax({
- url:"fetch_single.php",
- method:"POST",
- data:{eid:eid},
- dataType:"json",
- cache: false,
- success: function(data){
- alert('success');
- },
- // its always failing.
- error: function(){
- alert('failure');
- }
- <?php
- //fetch_single.php
- include_once("db_connect.php");
- if(isset($_POST["eid"]))
- {
- $output = array();
- $query = "SELECT * FROM employee WHERE id = '".$_POST["eid "]."'";
- $result = mysqli_query($connection, $query);
- while($row = mysqli_fetch_array($result))
- {
- $output["id"] = $row["id"];
- $output["employee_name"] = $row["employee_name"];
- $output["employee_salary"] = $row["employee_salary"];
- $output["employee_age"] = $row["employee_age"];
- }
- echo json_encode($output);
- }
- ?>
Add Comment
Please, Sign In to add comment