转自:Difference between $.ajax() and $.get() and $.load()

$.ajax() is the most configurable one, where you get fine grained control over HTTP headers and such. You're also able to get direct access to the XHR-object using this method. Slightly more fine-grained error-handling is also provided. Can therefore be more complicated and often unecessary, but sometimes very useful. You have to deal with the returned data yourself with a callback.

$.get() is just a shorthand for $.ajax() but abstracts some of the configurations away, setting reasonable default values for what it hides from you. Returns the data to a callback. It only allows GET-requests so is accompanied by the $.post() function for similar abstraction, only for POST

.load() is similar to $.get() but adds functionality which allows you to define where in the document the returned data is to be inserted. Therefore really only usable when the call only will result in HTML. It is called slightly differently than the other, global, calls, as it is a method tied to a particular jQuery-wrapped DOM element. Therefore, one would do: $('#divWantingContent').load(...)

It should be noted that all $.get()$.post().load() are all just wrappers for $.ajax() as it's called internally.

More details in the Ajax-documentation of jQuery: http://api.jquery.com/category/ajax/

Difference between $.ajax() and $.get() and $.load()的更多相关文章

  1. js进阶 14-1 jquery的ajax系列中的load方法的作用是什么

    js进阶 14-1 jquery的ajax系列中的load方法的作用是什么 一.总结 一句话总结:jQuery load()方法作用是从服务器加载数据,是一个简单但强大的AJAX方法. 1.load函 ...

  2. jQuery 学习05——AJAX:定义、load()方法、get()/post()方法

    AJAX = 异步 JavaScript 和 XML(Asynchronous JavaScript and XML). load() 方法:从服务器加载数据,并把返回的数据放入被选元素中. 语法:$ ...

  3. Ajax学习笔记(2)--load()方法

    <head runat="server"> <title></title> <script src="http://localh ...

  4. [Full-stack] 网页布局艺术 - Less

    故事背景 一个过程: template/html ----> css ----> less ----> bootstrap/flex ----> Semantic-ui fle ...

  5. jquery接触初级-----ajax 之:load()方法

    jquery _ajax 请求主要有几种方式:load(),$.get(),$.post(),$.ajax(),$.getScript(),$.getJson() 1.load()方法 格式:load ...

  6. JavaScript权威设计--jQuery,Ajax.animate,SVG(简要学习笔记二十)[完结篇]

    1.$和jquery在全局命名空间中定义的唯一两个变量.   2.jquery是工厂函数,不是构造函数.他返回一个新创建的对象.   3.jquery的四种调用方式:     <1>传递C ...

  7. Ajax_04之jQuery中封装的Ajax函数

    1.PHP中json_encode编码规则: PHP索引数组编码为JSON:[...] PHP关联数组编码为JSON:{...}2.jQuery中AJAX封装函数之load: ①使用:$('选择器') ...

  8. 从 AJAX 到 JSONP的基础学习

    目录索引: 一.AJAX的概念二.POST && GET三.原生实现AJAX简单示例 3.1 实现代码 3.2 重点说明四.框架隐藏域 4.1 基本概念 4.2 后台写入脚本 4.3 ...

  9. JQuery的ajax

    JQuery-AJAX: jQuery load() 方法是简单但强大的 AJAX 方法. $(selector).load(URL,data,callback);(这三个参数可以随意设置几个) @ ...

随机推荐

  1. 作业3:PSP记录耗时情况

    PSP2.1 Personal Software Process Stage Time planning 计划 10min Estimate 估计这个任务多久完成 150min Developing ...

  2. centos top命令列解释

    查看单个进程:top -p 进程号 PID(Process ID):进程标示号 ( 每个 process 的 ID ) USER:进程所有者的用户名 ( 该 process 所属的使用者 ) PR:进 ...

  3. PostgreSQL 表空间

    PostgreSQL 表空间 一 介绍使用表空间可以将不同的表放到不同的存储介质或不同的文件系统下,实际上是为表指定一个存储的目录.创建数据库,表,索引时可以指定表空间,将数据库,表,索引放到指定的目 ...

  4. sql 存储过程带有模糊查询条件

    一个简单的存储过程: Create procedure [dbo].[Proc_SeachJob] (@startRecordIndex int, @endRecordIndex int, @seac ...

  5. java随笔——HashMap与红黑树

    前言: hashmap是一种很常用的数据结构,其使用方便快捷,接下来笔者将给大家深入解析这个数据结构,让大家能在用的时候知其然,也知其所以然. 一.Map 首先,从最基本的讲起,我们先来认识一下map ...

  6. nginx反向代理后abp的webapi host如何获取客户端ip?

    dotnet core 跨平台是微软伟大的创举,脱离iis后服务器成本都降低了. 问题 这不,采用abp搞了个小项目,部署到centos后发现审计日志里面的ip信息不对. 解决 这个问题在.net 4 ...

  7. LockBox的安装

    LockBox是一套加密解密库,下载地址:http://sourceforge.net/projects/tplockbox/ 我的安装的操作系统:win7 64位 安装步骤如下: 一,安装: 安装时 ...

  8. “全栈2019”Java第八十九章:接口中能定义内部类吗?

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  9. acedSSSetFirst选择集夹点亮显实例

    ads_name ss; //执行预选 好像可以无视PICKSTYLE变量 if (RTNORM != acedSSGet(_T("I"),NULL,NULL,NULL,ss)) ...

  10. luncene 查询字符串的解析-QueryParser类

    搜索流程中的第二步就是构建一个Query.下面就来介绍Query及其构建. 当用户输入一个关键字,搜索引擎接收到后,并不是立刻就将它放入后台开始进行关键字的检索,而应当首先对这个关键字进行一定的分析和 ...