function callResourceAdapter(type, url, requestContent, successCallback, failCallback) { if (requestContent == null){ requestContent = {}; } if (type == null){ type = 'POST'; } function invocationSuccess(result) { var resultJson = result; if(resultJson.msgCode == '800'){ if (successCallback && typeof(successCallback) == "function") { successCallback(resultJson.rows,resultJson.map,resultJson.vo,resultJson.msg); } } if(resultJson.msgCode == '801'){ showToast(resultJson.msg); } if(resultJson.msgCode == '900'){ var message = '系统错误,请联系管理员'; if(resultJson.msg){ message = resultJson.msg; } showToast(message); if (failCallback && typeof(failCallback) == "function") { failCallback(); } } } function invocationFailure(error) { showToast('无法连接至服务器,请稍后再试'); if (failCallback && typeof(failCallback) == "function") { failCallback(); } } $.ajax({ type: type, url: serverUrl+url, data: JSON.stringify(requestContent), crossDomain:true, contentType: "application/json; charset=utf-8", // dataType: "json", timeout:120000, statusCode:{ 404: function() { showToast('服务器无响应,请稍后再试') }, 422: function() { showToast('应用程序请求对象错误,请稍后再试') }, 403: function() { showToast('无访问权限') }, 400: function() { showToast('应用程序请求无效,请稍后再试') }, }, success: function (data, textStatus, jqXHR) { switch (jqXHR.status) { case 200: invocationSuccess(data); break; default: break; } }, error: function (jqXHR, textStatus,errorThrown) { invocationFailure(jqXHR); } }) } function showToast(text,timeout) { $(".yui-toast-mask").remove(); var html = [ '