Being new to this, I have a problem with what I believe to be a simple question. Why is 'undefined' being returned from the function below?
- function validate_manager(manager_id) {
-
- var a = $.ajax({
- type: "POST",
- dataType:"JSON",
- data: {
- ajaxCall: 1,
- manager_id: manager_id
- },
- url: "/system/php/ajx_check_username.php",
- async: false // Wait for completion ......
- });
-
- a.done(function(data) {
- console.log(data);
- return data;
- });
-
- a.fail(function(response) {
- var data = {
- success: false,
- error_message: response.status+':'+response.statusText
- };
- console.log(data);
- return data;
- });
- }
The console.log is outputting what I want, but the calling function gets 'undefined',
Sure this is simple, but its breaking me now!!