How do you show a loader until AJAX response? HTML, CSS and JavaScript | Live AJAX loader Demo

Описание к видео How do you show a loader until AJAX response? HTML, CSS and JavaScript | Live AJAX loader Demo

When you call Ajax and you need to display loading image or loader then you must have to follow this blog. In this blog we will create live example to display loading image or loader when Ajax call is in progress. Enjoy!

Let’s start step by step to configure the code for ajax loader.

Step 1: Create one simple table like calendar_event_master and store some sample data which we will use for demo purpose.
Step 2: Now you need to create one simple HTML file.

In this file we have included some CSS and JavaScript library like jquery.min.js, bootstrap.min.js and bootstrap.min.css which is used for web designing and make it much easier to use JavaScript on your website.

We added some custom CSS class like .loader-div and .loader-img that will be helpful to display your loader image in center.

We create one button and set onclick method. In above code you can see we have declare onclick="display_data()" event. When you click on this button we call AJAX to get data from the database.

Inside display_data() function we have added below code to show loader while Ajax call in progress.

$(".loader-div").show(); // show loader

To hide loader you need to use below code.

$(".loader-div").hide(); // hide loader

Step 3: Finally, you need to create one PHP file like display_data.php to get data from the database.

In this file we have included one connection file database_connection.php that will be helpful to connect your database.

Once your database connected then you need to write one select query to retrieve data from the database. Finally, you need to send response with json_encode($data) and that data will be display on page.

Blog and source code link: https://shinerweb.com/how-to-display-...

0:00 Introduction
0:25 How image loader work.
1:00 Start coding
2:55 Include required library
5:40 Show and Hide Loader Logic
13:00 Recap

🔔 Subscribe for more YouTube videos.
https://youtube.com/shinerweb?sub_con...

//Recommended videos:
▶️ How to create cron job in codeigniter –    • How to create cron job in codeigniter...  
▶️ How to create cron job in laravel –    • How to create cron job in laravel | A...  
▶️ How to create web push notification for website –    • How to create web push notification f...  
▶️ how to fix http error 500 –    • how to fix http error 500 | how to so...  
▶️ Subdomain not working –    • subdomain not working dns_probe_finis...  

//Let’s Connect:
👉 Subscribe: (   / shinerweb  )
👉 Twitter: (  / shiner_web  )
👉 Facebook: (  / shinerweb  )
👉 Instagram: (  / shinerweb_official  )
👉 Website/Blog: (https://www.shinerweb.com/)

//About us:
Here we’re providing technical solutions related website development and mobile app development. We are highly updating people using our channel with current affairs, social news, political news and with the new features of updated applications. Here you will get chance to connect yourself with digital world.

//Disclaimer:
Links included in this description might be affiliate links. If you purchase a product or service with the links that I provide, I may receive a small commission. There is no additional charge to you! Thank you for supporting us so We can continue to provide you with free content each week!

#ajaxloader #ajax #loader #javascript #javascripttutorials #jquery

Комментарии

Информация по комментариям в разработке