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.

Based on 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 just one “Load More” button on your website to show a list of things. It’s a common way to organize information on websites and mobile apps. People click the button when they want to see more items.

When you click the button, more items will be added to the list you already see.

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

Drag and Drop File Upload with jQuery and AJAX

Utilizing the drag and drop functionality presents a user-friendly method to enable file uploads by effortlessly dropping files into a designated container. Nowadays, numerous websites offer the convenience of uploading files through both drag and drop and traditional file browsing methods, such as PushBullet, Facebook, SlideShare, and many others.

To achieve this functionality, I employ AJAX to seamlessly save the files to the server, which is triggered as soon as a file is dropped onto the specified target container.

Within this tutorial, I show how you can seamlessly implement a similar feature into your own project. By using jQuery AJAX and PHP, you can not only enable the drag and drop file upload but also showcase a thumbnail preview of the successfully uploaded file.

Drag and Drop File Upload with jQuery and AJAX

Read more

How to read RSS feeds using PHP

In today’s fast-paced world, staying up to date with the latest news and blog posts is essential. One of the easiest ways to do this is by subscribing to RSS feeds, which allow you to receive the latest updates from your favorite websites directly in your RSS reader.

RSS (Really Simple Syndication) is a format that is used in many websites which allow web publisher to syndicate their latest posts or data automatically.

There is another method that allows the user to stay updated is bookmarking. But users need to manually go to websites on a timely basis and check what new has been added.

In this tutorial, I will show how you can use PHP to read RSS feeds of websites and show recent post lists using it.

How to read RSS feeds using PHP

Read more