My Ajax code is
$("a#edit").click(function(){
var id = $(this).closest('tr').attr('id');
//alert(id);
$.ajax({
url: 'getdata.php',
type: "POST",
dataType:'JSON',
data: {
id: id,
},
success:function(result){
alert(result);
}
});
});
My php code is here...
if ($_REQUEST['id'] != "")
{
$id=$_REQUEST['id'];
$sql = "select * from visit_reports WHERE visit_planner_id='$id'";
$query = sqlsrv_query( $link, $sql);
while($data = sqlsrv_fetch_array($query,SQLSRV_FETCH_ASSOC))
{
print_r($data);
}
}
In firebug the array i get ..
Array
(
[id] => 1.0000
[visit_planner_id] => 230338
[bi_staff_present_name] => BI staff present name
[bi_staff_trial_function] => BI staff trial function
)
Now how i can use this array value into my specific input field of modal form ?
Aucun commentaire:
Enregistrer un commentaire