How to check Broken Image with jQuery and AJAX

The images which are wouldn’t successfully load on the web page will show nothing when the source does not exist.

It looks bad when there are many images and some of them are missing.

For solving this you need to look through all the pages and find the broken images and fix them manually time to time. It is a time-consuming process.

In this tutorial, I will show you two examples, to automatically detect the broken images and replace with another image.

  • In the first one, I am using the jQuery, and
  • In the second, using AJAX with jQuery

How to check Broken Image with jQuery and AJAX

Read more

How to fire AJAX Request on Regular Interval

Sometimes, we need to update parts of a webpage regularly. For instance, displaying live cricket or football scores, or showing the latest news feeds.

There are two ways to schedule AJAX requests:

  1. Using the setInterval() function
  2. Using the setTimeout() function

Both methods essentially do the same thing, but they’re better suited for specific situations. Let’s explore these in this tutorial.

How to fire AJAX Request on Regular Interval

Read more

Sorting the Table by clicking Header with AJAX

With sorting the list it is easier for the user to locate items in a sorted list than unsorted. It rearranges the data in specific order (ascending or descending).

You can either use PHP or AJAX to get the sorted data.

I am using AJAX to sort the list in this tutorial.

In this tutorial, I am displaying the employee’s list and attach click event on the table column header. Whenever header gets clicked then send an AJAX request with column name to sort with.

Sorting the Table by clicking Header with AJAX

Read more

Step-by-Step: File Uploads Made Easy with Dropzone.js and PHP

In web development, file upload functionality is a common requirement for many applications. PHP offers multiple choices for file uploads, but among them, Dropzone.js is widely favored. This JavaScript library streamlines the file upload process and offers an interface that can be customized and easily used by users.

Dropzone.js can be used with or without jQuery in your project, and it does not have any additional library requirements. This library does not handle file uploads to your server directly. In this tutorial, PHP will be used for uploading.

File upload can be done by either dragging and dropping or by using the file chooser dialog that opens when the drag n’ drop widget is clicked. While uploading, Dropzone.js displays a progress bar, generates a thumbnail image, and provides file size preview after uploading.

Step-by-Step: File Uploads Made Easy with Dropzone.js and PHP

Read more