is a connection (stream) with the executable file, the text goes to the client instead of the server monitor. However, before you send the required text, you must first send the following information:
Content-Type: text/html\n\n
This explains why you have the first print statement. The required text is in the variable, $value. The second print statement sends the required text.
Illustration with PHP
There are two PHP programs below. Each of these programs does exactly what the Perl program (code segment) above does. With PHP, if Ajax used POST to send the query string, then at the server, PHP will have the name/value pairs of the query string in an associative array, called $_POST. This is an internal PHP array and it is globally accessible. An associative array consists of keys with corresponding values. For the query string name/value pairs, the $_POST array keys are names, while the corresponding array values are query string values. The following PHP code is for the POST method:
<?php
$value = $_POST["fname"];
echo $value
?>
This is a PHP executable file whose name has to be in the URL of the Ajax code at the client. There are two lines in the code. The first line uses the name, "fname" as key of the $_POST associative array to obtain the value, "John". This value is assigned to the variable, $value. Remember, the associative array will always hold the query string sent. The second line in the code sends the value "John" into the stream of the connection.
The following code does the same thing, but for the GET method. Here PHP has the $_GET associative array to hold the name/value pairs of the query string, sent by Ajax, using the GET method.
<?php
$value = $_GET["fname"];
echo $value
?>
Conclusion
At the server there is no new standard or technology for Ajax. All you have to know is how a language gets the data from the query string sent and how it sends text (any string) back into a connection stream initiated from the client. You can use any language for this: C++, Borland Delphi, Visual Basic.net etc. I have used only perl and PHP for illustration.
Learn more about this author, Chrys.
Click here to send this author comments or questions.
Below are the top articles rated and ranked by Helium members on:
by AJL
I cannot express how much I really LOVE AJAX. I have been a web developer for the past 8 years and I have to say that microsoft's
by Obsidian
What is AJAX? Well, the textbook definition, Asynchronous JavaScript and XML, is not of much help to the average reader
by Chrys
Making Ajax Request
Ajax Web Technology Explained Part 1
Introduction
This is part 1 of my article series, Ajax Web Technology
The acronym Ajax meaning Asynchronous Javascript and XML,refers to the use of several web technologies in an application
by ARC IDEA CO
In e-business's point of view, in order to appeal to its customers of clientele, you need to have a website or a web front.
Add your voice
Know something about Ajax web technology explained?
We want to hear your view.
Write now!
Cast your vote!
Click for your side.
Featured Partner
ResearchSEA - Asia Research News
ResearchSEA - Asia Research News is Asia's first research news portal. It is a one-stop center where journalists a...more
hide