i have the following code: Javascript object:
var getDBresults = (function () {
function getResult(url,TableName ,callback){
$.ajax({
url: url,
type: 'POST',
data: {
'table':TableName,
},
dataType: 'json',
success: function(data){
callback(data);
console.log(data)
},
error: function(){}
});
}
return {
getAllVideoes: function(){
getResult("getAllResults.php", "videoer", function(data){
return data;
});
}
}
})();
simple php script:
<?php
$tableName = $_REQUEST['table'];
echo $tableName;
?>
My js command for fetching(seperate script ofc):
var obj = getDBresults;
var data = obj.getAllVideoes();
console.log(data)
My issue is with the callback function. It wont output anything and it doesn't seem to be running at all.. Had this issue for quite som time now and i just cant figure it out.. Is there anything i'v been missing? All help is apriciated! Sorry for my spelling btw.