In this tutorial you will learn how to use jQuery to GET JSON from a URL. Recommended training (Free for 7 days) : https://juniordevelopercentral.com/tr... 👍
That's on the assumption that the URL you are trying to send a request to actually returns a JSON response but if you have an endpoint or script that returns JSON data (or even a JSON file) then you can use jQuery to retrieve that data.
In the tutorial you will get an understanding of the way jQuery GETs JSON from a URL using the AJAX convenience function built in to jQuery. You could retrieve this data on the page load or it could be triggered on a JavaScript event for example a button click.
You'll learn how to send a GET request to a PHP script locally on your computer which in the example will just return some a basic JSON structure but in reality it could be generated from your web application such as data retrieved from a database.
jQuery has traditionally relied on callback functions built in to it's convenience functions for GET and POST AJAX requests but in the tutorial you will learn how to use jQuery's inbuilt promise chaining system. You'll also use arrow functions to provide the callbacks to this promise-like feature to make your code super tight and readable.
If you'd like to find out more about arrow functions take a look at the Junior Developer Central video at : • JavaScript Arrow Functions ES6: How t...
Using the convenience functions for AJAX the jQuery GET JSON from URL process can be simplified and you can easily connect failure handling in to the chain by ensuring the .fail method has a callback provided. Channel Handle @codebubb
Смотрите видео jQuery GET JSON from URL Tutorial: Retrieve data from a PHP script онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code With Bubb 24 Сентябрь 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 10,88 раз и оно понравилось 8 людям.