首页 > 技术文章 > 同步ajax请求

qiushuiblog 2017-08-30 18:53 原文

/*
 * 发送同步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;
}

 

推荐阅读