同步ajax请求

/*
 * 发送同步ajax请求的函数 CreateBy 秋水
 */
function syncAjax(data) {
    var resp = null;
    $.ajax({
        type : "POST",
        url : 'mvc/dispatch',
        data : data,
        async : false,
        dataType : "json",
        success : function(response) {
            resp = response;
        },
        error : function(response) {
            resp = response;
        }
    });
    return resp;
}
原文地址:https://www.cnblogs.com/qiushuiblog/p/7454804.html