I have the following function:
function sendDocument( objektnummer, id )
{
var url = $( "#objectdata" ).data( "url-send" );
var data = {};
data["objektnummer"] = objektnummer;
data["id"] = parseInt(id);
var result = false;
$.ajax({
type: "POST",
url: url,
data: data,
dataType: "json"
})
.done(function(resp){
console.log("send ajax was successfull");
result = true;
})
.error(function(resp){
console.log("no connection");
result = false;
});
console.log(result);
return result;
}
in the console I got the positive message "send ajax was successful", but when I print the result on the end of the function to the console, I see that the variable result have the value false
.