Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找一个典型示例,其中调用 jQuery 函数 getJSON 比使用标准 AJAX 函数(来自 jQuery 或来自本机 JavaScript)具有很大优势。
它更短。基本上 .getJSON 只是 jQuerys 的捷径
$.ajax({ url: url, dataType: 'json', data: data, success: callback });
现在你只做
$.getJSON(url, calllback);
使用普通 AJAX 的优势应该是相当明显的,因为它的输入要少得多,并且可以处理所有烦人的浏览器特定差异。