How to Validate Image width and height Before upload using JavaScript

While allowing users to upload files then there may be a case arrives where you have to restrict image width and height before upload.

This is very common in Job Application Forms where the user can only upload its profile photo of given dimensions other it’s not uploaded.

In this tutorial, I explain with an example how you can implement it. For uploading, I am using AJAX and PHP and done restrictions with JavaScript.

How to Validate Image width and height Before upload using JavaScript

Read more

How to Send JavaScript Array to the AJAX using jQuery and PHP

The process of sending JavaScript arrays to the server-side using AJAX is a frequent requirement in web development. JavaScript arrays allow us to store and manage data in a structured format.

This can be used to pass the group of related values as data to the $.ajax for processing and get the response.

E.g. pass all checked checkboxes values, selected values from the list.

In this tutorial, you will learn how to send a JavaScript array to the server-side using AJAX, jQuery, and PHP with a live example.

How to Send JavaScript Array to the AJAX using jQuery and PHP

Read more

Return JSON response from AJAX using jQuery and PHP

JSON or JavaScript Object Notation is a widely used transmitting format for passing data between a server and a web application. It is the most efficient way to return multiple values as a response from the PHP script to jQuery.

It is not possible to return an array directly from AJAX, and it must be converted into a valid format. You can either use the XML or JSON format.

In the tutorial demonstration, I will return an array of users from AJAX, while return converts the array into JSON format using the json_encode() function in the PHP.

On the basis of response show data in tabular format.

Return JSON response from AJAX using jQuery and PHP

Read more

Load more results with jQuery AJAX and PHP

You can use a single load more button on your webpage to paginate the list of records.

This type of pagination is very common on websites or in mobile apps. The user must click on the load more button whenever they need to view more items.

After the click, the data will append with the existing list items.

In this tutorial, I am creating a similar type of functionality using jQuery and AJAX.

Load more results with jQuery,AJAX, and PHP

Read more