1
Next I’m trying to return a database value via Ajax.
By clicking the button:
<button id="btn-database-finder" name="database-link" type="button" class="btn btn-outline btn-primary btn-xs btn-to-right" data-toggle="modal" data-target="#databaseModal">Visualizar</button>
He’s going to Ajax:
$("#btn-database-finder").on("click",function(){
var radioid = $('#id-viewer').html();
$.ajax({
type:"post",
url:"../connect/post/select.php",
data:'database-link='+radioid,
success:function(responseData, textStatus, jqXHR, data){
$("#database-viewer").html('<a href=../dashboard/dist/archives/databases/'+data+'><i class="fa fa-file-archive-o fa-5x" aria-hidden="true" style="cursor: pointer;"></i></a>');
}
});
});
That takes this line:
<i class="fa fa-hashtag" id="id-viewer" aria-hidden="true"></i>
Where is the ID join the TAG li.
This part is all working, putting a Alert() appears the ID, but when he goes to the url:"../connect/post/select.php",
That is:
if($_SERVER['REQUEST_METHOD']=='POST'){
$stDatabase = $_POST['database-link'];
$sendDatabase = $selDatabase->selectDatabase($stDatabase);
exit();
}
It always returns the as Undefined:
<a href="dashboard/dist/archives/databases/undefined"><i class="fa fa-file-archive-o fa-5x" aria-hidden="true" style="cursor: pointer;"></i></a>
According to the api, there are only 3 parameters in
success
:data
,textStatus
andjqXHR
.– Kiritonito