javascript - 从同一个方法调用所有同类型的http请求
问题描述
在大型 Web 应用程序中,在通用 .js 文件中使用通用 javascript http_get方法(例如下面的示例)而不是分别编写它们是否有任何优点或缺点?
function http_get(url, async) {
var post = $.ajax({
type: "GET",
url: url,
async: async,
dataType: "json",
contentType: "application/json"
});
return post;
}
提前致谢。
解决方案
推荐阅读
- android - Android SDK 在 Linux 上缺少模拟器臂
- django - POST 请求不适用于 Django 表单和 Django 表单集
- javascript - React Router (v.4) 动态路由问题
- java - 更改 SOAP xml 响应中的标签名称(类中的字段和响应中的标签必须不同)
- asp.net-core - Asp.Net Core 3 优雅关闭抛出 OperationCanceledException
- bash - 如何在 bash 中为读取命令设置浮点超时值?
- docker - 在 k8s 中使用没有注册表设置的本地 docker 镜像
- ios - 如何在 swift/iOS 中准确计时“点击”间隔
- javascript - 从控制器发送两个参数到 Ajax | 网络
- javascript - Javascript - 函数没有从 JQuery 获取外部输入值