that's my part of the code:
$("#edit-field-order-borispol-und").change(foo);
function foo() {
var result;
var customerid = $( "#edit-field-order-customer-und" ).val();
$.ajax({
type: 'GET',
url: '/ops',
data: {'customerid': customerid},
success: function(response) {
result = response.borispol;
alert(response.borispol);// this alerts the info that i NEED...
}
});
return result;
}
foo(function(result) {
alert(result+' it works'); // cant make it to work...
// code that depends on 'result'
});
I have checked this: How do I return the response from an asynchronous call?
and still... I cant figure out what is wrong. Please help i'm totaly new to jquery...