Ajax & PHP scripts
The popularity of Ajax is increasing day by day. One of the best example as used by google is google suggest. Here based on the user keywords entered at search box, google returns matching keywords or extension of this words as searched before by users.
Checking Script support
As Ajax depends on client side scripting, we need to check the script support is enabled ( in browser ) or not. Here is the code we can use to display message if scripting is disabled.
Let us start with some examples on uses of Ajax
To work in Ajax we have to create XMLHttp request objects based on type of browser. This object we will use to pass data and collect the data from the server.
Using GET method we can submit form details to a backend PHP script using Ajax
Displays a clock showing server time where request is send in every second to server to get the data
Datalist can be used for auto complete of a textbox. We will learn how to add options to a datalist.
We will be using Ajax to send the selection value of first drop down list and then based on this value we will send one more dependant drop box.Read More
We will use Ajax to pass email data as entered by user and then this address is checked with a validation code written in PHP. Read More
Using Ajax we can Post customer id to server and collect the matching details of the customer. . Read More
We can create a paging script by breaking records into pages using Ajax, PHP and MySQL database. . Read More
We need to communicate with visitors while processing data in server. Learn the basics of displaying, hiding messages using layers by DIV tag.
The status of script exection can be shown by a growing progress bar. This is the basic of how to display a growing progress bar.
Data is taken from a MySQL table and status is updated from the main script.
We can display the error messages without reloading the page or sending all the data to server side script by using PHP and Ajax
While filling the data we can validated the form by sending the details to server side script by using Ajax and PHP.
What is Json ? How to know Json support is available in our PHP or not? What we can do with our Json functions? . . Read More
We can get the result from our database table by applying search command. Here data is posted to backend query as we type and results are displayed.
Records of a sub-category can be displayed after selection of a category from a drop down list box.
<noscript>Your browser does not support scripts, you have to enable it to run this page</noscript>
|Demo Link|| Description|
|GET method||Form data is posted and returned after processing by GET method|
|ListBox||On select of List box details of that record is displayed|
|Linked Records||On Selection of one listbox option all the records linked to it will be displayed|
|Paging of records||With Backword and Forward buttons and displaying 10 records per page|
|Keyword Search||Display the matching search result as we type the chars|
|Form Validation||Validating all inputs entered by user in a web form|
|Form Validation II||Validating inputs as soon as focus is shifted out in a form|
|Email Validation||Validating Email address as entered by user|
|Signup & login method||Validation of Signup form and displaying error messages without reloading|
This article is written by plus2net.com team.
| ▼ Click for more tutorial on Ajax & PHP
|testing the form|
|testing the data.|
|Ajax combined with PHP is so interesting, I thought programming with ajax is difiicult but now my mind is opened. So if I can ask, Is there a specific part of which when I am saying I want to learn Ajax, I should start with?|