can you help me with this problem? In success:.... I get a result that I need, but ajaxFunction at the end returns ' ' value.
ajaxFunction = function(lastNumber){
var json_result = '';
$.ajax({
type: "POST",
contentType: "application/json",
dataType: "json",
data: '{"first" : "'+lastNumber+'"}',
url: "http://localhost:8080/some_url",
success: function (result) {
console.log("in success: " + result.result);
json_result = result.result;
}
});
console.log("before return " + json_result);
return json_result;
};