Possible Duplicate:
How to return the response from an AJAX call from a function?
function Run(someJsonObject) {
    $.ajax({
        type: "post",
        contentType: "application/json; charset=utf-8",
        url: "/MyWebService",
        data: JSON.stringify(someJsonObject),
        dataType: "json",
        success: function (data) {
            var parsedJson = jQuery.parseJSON(data.d);
            // Do some magic...
            return true; // success!
        },
        error: function (jqXHR, textStatus, errorThrown) {
            return false;
        }
    });
}
var result = Run({dummy:'dummy'});
If I'm not mistaken, the above function will not return true or false, but rather it will be undefined. I want to return the result of the AJAX call, I'd prefer to make it synchronous (I realize I'm using AJAX). How would I accomplish this?
 
     
     
     
     
    