Code:
function getEcoScore(geometry, dataType){
return $.ajax({
type:'POST',
data: {geometry:geometry,
attType:dataType},
dataType:'text',
url: 'php/eco_query.php'
});
}
function test(){
var x = getEcoScore(geoJsongeom,"wetlands").done();
console.log(x.responseText);
}
I want to store the result of this request and run a few other requests on different tables, then process the results into an HTML format to form a pop up/dialog box. When I run this code with just console.log(x), I get and object with the responseText, however, then I try to access the responseText it comes up as undefined.
I have tried processing the response in done(function(data){...code...}); but still all i get is an object for x. Is there a particular function for accessing the responseText?
I have used a callback function to assign the response to a global variable & that remains undefined.
The main issue is why I cannot access the responseText variable of the response.