Category: AJAX

On WordPress, you have noticed that while writing a blog post it will autosave the post as a draft after the specified interval.

In this tutorial, I am creating the similar type of functionality with jQuery and AJAX. Where I check for any value update in input element if it is then set an interval of 5 seconds.

Send an AJAX request to save data when the interval gets completed.

Autosave data after specific time with jQuery and AJAX


Star rating bar gives an option to the user to submit his thoughts whether the content is good or not. This gives the administrator a view how well its item is performing.

It is very common on the e-commerce websites.

In this tutorial, I am using jQuery Bar Rating plugin to display star rating on the screen. Whenever the user changes the rating then send an AJAX request to save the user currently rating status on the MySQL database table with PHP.

5 Star Rating system with jQuery, AJAX, and PHP


You can use jQuery AJAX to autocomplete data on the single or multiple elements when the user search or select value from an element.

It is a better way to allow the users to easily search for data in existing records and get required information e.g. get student details by its id, product details, etc.

In the demonstration, I am using jQuery UI to display suggestion list and fetch details using PHP from the MySQL database table when a value from the suggestion list is gets selected.

How to autocomplete data on multiple fields with jQuery and AJAX


If you know how to send jQuery AJAX request in Core PHP then it is simpler for you to do it in CodeIgniter.

In CodeIgniter, you can use the controller and model to handle AJAX call instead of creating the separate file. Make AJAX call either from the view or external script file.

In this tutorial, I am creating a simple example to demonstrate the AJAX calling in CodeIgniter.

How to Send AJAX Request In CodeIgniter


Load more pagination allows the users to load new content on a button click. This appends new content with existing contents.

It is the type of infinite pagination where the user has to click the action button to view new records. This load data until records are available.

In this tutorial, I am implementing this functionality on a page with AngularJS and PHP.

Load more pagination with AngularJS and PHP


The autocomplete functionality shows the suggestion list according to the entered value. The user can select a value from the list.

With jQuery UI you can easily add autocomplete widget on the input element. Navigate to the suggestion list either by mouse or keyboard arrow keys.

It has the various options that allow us to customize the widget.

You can fix the suggestion source value while initializing in this case whenever the user typed any character then it searches the value within the given source value or you can make it dynamic with AJAX.

In the demonstration, I am implementing this on an element which shows the user’s name list according to the entered value with AJAX.

jQuery UI autocomplete with PHP and AJAX


AJAX is use to communicate with the server to perform the action without the need to refresh the page.

You can either handle AJAX requests on the same page or on the separate page.

In this tutorial, I show how you can send and receive AJAX requests on the same page.

How to handle AJAX request on the same page - PHP


The infinite page scroll you have seen on the social networking sites – Facebook, Twitter or on e-commerce websites where the new content is automatically loaded when scrolling down to the web page.

For implementing this functionality using jQuery to detect page scroll when the user reaches the end of the web page then send an AJAX request to load new content.

Load content on page scroll with jQuery and AJAX


For upload file with AngularJS need to send the file by $http service and with the use PHP store the requested file to the server and return a response.

In the demonstration, I am creating two examples –

  • In the first, using JavaScript to select file,
  • And in the second, using custom directive

Then pass it as data in $http service for upload.

Upload file with AngularJS and PHP

AJAX AngularJS

When working with multiple AJAX requests at that time its hard to detect when will be all request is being completed.

You can use the setTimout() method which will execute your action after your given time. But it is not a better solution.

jQuery have inbuilt AJAX event handler that helps you in this situation.

Detect when all AJAX requests are complete - jQuery

AJAX Jquery