Home >Web Front-end >JS Tutorial >Summary of jQuery asynchronous methods to obtain json data_jquery
There are two ways for jQuery to asynchronously obtain json data, one is the $.getJSON method and the other is the $.ajax method. This article uses these two methods to asynchronously obtain json data and then append it to the page.
Create the data.json file in the root directory:
■ Get json data through $.getJSON method
■ Obtain json data through $.ajax method
总结:使用$.getJSON方法和$.ajax方法都能达到相同的效果,但是,如果想对异步获取的过程有更细节的控制,推荐使用$.ajax方法。