Skip to main content

PHP - AJAX

PHP - AJAX Introduction AJAX is about updating parts of a web page, without reloading the whole page. What is AJAX? AJAX = Asynchronous JavaScript and XML. AJAX is a technique for creating fast and dynamic web pages. AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page. Classic web pages, (which do not use AJAX) must reload the entire page if the content should change. Examples of applications using AJAX: Google Maps, Gmail, Youtube, and Facebook tabs. How AJAX Works AJAX AJAX is Based on Internet Standards AJAX is based on internet standards, and uses a combination of: XMLHttpRequest object (to exchange data asynchronously with a server) JavaScript/DOM (to display/interact with the information) CSS (to style the data) XML (often used as the format for transferring data) AJAX applications are browser- and platform-independent! Google Suggest AJAX was made popular in 2005 by Google, with Google Suggest. Google Suggest is using AJAX to create a very dynamic web interface: When you start typing in Google's search box, a JavaScript sends the letters off to a server and the server returns a list of suggestions. Start Using AJAX Today In our PHP tutorial, we will demonstrate how AJAX can update parts of a web page, without reloading the whole page. The server script will be written in PHP. PHP - AJAX and PHP AJAX is used to create more interactive applications. AJAX PHP Example The following example will demonstrate how a web page can communicate with a web server while a user type characters in an input field: Example Start typing a name in the input field below: First name: Suggestions: Example Explained In the example above, when a user types a character in the input field, a function called "showHint()" is executed. The function is triggered by the onkeyup event. Here is the HTML code: Example

Start typing a name in the input field below:

Suggestions:

Code explanation: First, check if the input field is empty (str.length == 0). If it is, clear the content of the txtHint placeholder and exit the function. However, if the input field is not empty, do the following: Create an XMLHttpRequest object Create the function to be executed when the server response is ready Send the request off to a PHP file (gethint.php) on the server Notice that q parameter is added to the url (gethint.php?q="+str) And the str variable holds the content of the input field The PHP File - "gethint.php" The PHP file checks an array of names, and returns the corresponding name(s) to the browser: PHP - AJAX and MySQL AJAX can be used for interactive communication with a database. AJAX Database Example The following example will demonstrate how a web page can fetch information from a database with AJAX: Example Person info will be listed here... Example Explained - The MySQL Database The database table we use in the example above looks like this: id FirstName LastName Age Hometown Job 1 Peter Griffin 41 Quahog Brewery 2 Lois Griffin 40 Newport Piano Teacher 3 Joseph Swanson 39 Quahog Police Officer 4 Glenn Quagmire 41 Quahog Pilot Example Explained In the example above, when a user selects a person in the dropdown list above, a function called "showUser()" is executed. The function is triggered by the onchange event. Here is the HTML code: Example

Person info will be listed here...
Code explanation: First, check if person is selected. If no person is selected (str == ""), clear the content of txtHint and exit the function. If a person is selected, do the following: Create an XMLHttpRequest object Create the function to be executed when the server response is ready Send the request off to a file on the server Notice that a parameter (q) is added to the URL (with the content of the dropdown list) The PHP File The page on the server called by the JavaScript above is a PHP file called "getuser.php". The source code in "getuser.php" runs a query against a MySQL database, and returns the result in an HTML table: Firstname Lastname Age Hometown Job "; while($row = mysqli_fetch_array($result)) { echo ""; echo "" . $row['FirstName'] . ""; echo "" . $row['LastName'] . ""; echo "" . $row['Age'] . ""; echo "" . $row['Hometown'] . ""; echo "" . $row['Job'] . ""; echo ""; } echo ""; mysqli_close($con); ?> Explanation: When the query is sent from the JavaScript to the PHP file, the following happens: PHP opens a connection to a MySQL server The correct person is found An HTML table is created, filled with data, and sent back to the "txtHint" placeholder PHP Example - AJAX and XML AJAX can be used for interactive communication with an XML file. AJAX XML Example The following example will demonstrate how a web page can fetch information from an XML file with AJAX: Example CD info will be listed here... Example Explained - The HTML Page When a user selects a CD in the dropdown list above, a function called "showCD()" is executed. The function is triggered by the "onchange" event:
Select a CD:
CD info will be listed here...
The showCD() function does the following: Check if a CD is selected Create an XMLHttpRequest object Create the function to be executed when the server response is ready Send the request off to a file on the server Notice that a parameter (q) is added to the URL (with the content of the dropdown list) The PHP File The page on the server called by the JavaScript above is a PHP file called "getcd.php". The PHP script loads an XML document, "cd_catalog.xml", runs a query against the XML file, and returns the result as HTML: load("cd_catalog.xml"); $x=$xmlDoc->getElementsByTagName('ARTIST'); for ($i=0; $i<=$x->length-1; $i++) { //Process only element nodes if ($x->item($i)->nodeType==1) { if ($x->item($i)->childNodes->item(0)->nodeValue == $q) { $y=($x->item($i)->parentNode); } } } $cd=($y->childNodes); for ($i=0;$i<$cd->length;$i++) { //Process only element nodes if ($cd->item($i)->nodeType==1) { echo("" . $cd->item($i)->nodeName . ": "); echo($cd->item($i)->childNodes->item(0)->nodeValue); echo("
"); } } ?> When the CD query is sent from the JavaScript to the PHP page, the following happens: PHP creates an XML DOM object Find all elements that matches the name sent from the JavaScript Output the album information (send to the "txtHint" placeholder) PHP Example - AJAX Live Search AJAX can be used to create more user-friendly and interactive searches. AJAX Live Search The following example will demonstrate a live search, where you get search results while you type. Live search has many benefits compared to traditional searching: Results are shown as you type Results narrow as you continue typing If results become too narrow, remove characters to see a broader result Search for a W3Schools page in the input field below: The results in the example above are found in an XML file (links.xml). To make this example small and simple, only six results are available. Example Explained - The HTML Page When a user types a character in the input field above, the function "showResult()" is executed. The function is triggered by the "onkeyup" event:
Source code explanation: If the input field is empty (str.length==0), the function clears the content of the livesearch placeholder and exits the function. If the input field is not empty, the showResult() function executes the following: Create an XMLHttpRequest object Create the function to be executed when the server response is ready Send the request off to a file on the server Notice that a parameter (q) is added to the URL (with the content of the input field) The PHP File The page on the server called by the JavaScript above is a PHP file called "livesearch.php". The source code in "livesearch.php" searches an XML file for titles matching the search string and returns the result: load("links.xml"); $x=$xmlDoc->getElementsByTagName('link'); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q)>0) { $hint=""; for($i=0; $i<($x->length); $i++) { $y=$x->item($i)->getElementsByTagName('title'); $z=$x->item($i)->getElementsByTagName('url'); if ($y->item(0)->nodeType==1) { //find a link matching the search text if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q)) { if ($hint=="") { $hint="" . $y->item(0)->childNodes->item(0)->nodeValue . ""; } else { $hint=$hint . "
" . $y->item(0)->childNodes->item(0)->nodeValue . ""; } } } } } // Set output to "no suggestion" if no hint was found // or to the correct values if ($hint=="") { $response="no suggestion"; } else { $response=$hint; } //output the response echo $response; ?> If there is any text sent from the JavaScript (strlen($q) > 0), the following happens: Load an XML file into a new XML DOM object Loop through all elements to find matches from the text sent from the JavaScript Sets the correct url and title in the "$response" variable. If more than one match is found, all matches are added to the variable If no matches are found, the $response variable is set to "no suggestion" PHP Example - AJAX Poll AJAX Poll The following example will demonstrate a poll where the result is shown without reloading. Do you like PHP and AJAX so far? Yes: No: Example Explained - The HTML Page When a user chooses an option above, a function called "getVote()" is executed. The function is triggered by the "onclick" event: <html> <head> <script> function getVote(int) { var xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if (this.readyState==4 && this.status==200) { document.getElementById("poll").innerHTML=this.responseText; } } xmlhttp.open("GET","poll_vote.php?vote="+int,true); xmlhttp.send(); } </script> </head> <body> <div id="poll"> <h3>Do you like PHP and AJAX so far?</h3> <form> Yes: <input type="radio" name="vote" value="0" onclick="getVote(this.value)"><br> No: <input type="radio" name="vote" value="1" onclick="getVote(this.value)"> </form> </div> </body> </html> The getVote() function does the following: Create an XMLHttpRequest object Create the function to be executed when the server response is ready Send the request off to a file on the server Notice that a parameter (vote) is added to the URL (with the value of the yes or no option) The PHP File The page on the server called by the JavaScript above is a PHP file called "poll_vote.php": <?php $vote = $_REQUEST['vote']; //get content of textfile $filename = "poll_result.txt"; $content = file($filename); //put content in array $array = explode("||", $content[0]); $yes = $array[0]; $no = $array[1]; if ($vote == 0) { $yes = $yes + 1; } if ($vote == 1) { $no = $no + 1; } //insert votes to txt file $insertvote = $yes."||".$no; $fp = fopen($filename,"w"); fputs($fp,$insertvote); fclose($fp); ?> <h2>Result:</h2> <table> <tr> <td>Yes:</td> <td><img src="poll.gif" width='<?php echo(100*round($yes/($no+$yes),2)); ?>' height='20'> <?php echo(100*round($yes/($no+$yes),2)); ?>% </td> </tr> <tr> <td>No:</td> <td><img src="poll.gif" width='<?php echo(100*round($no/($no+$yes),2)); ?>' height='20'> <?php echo(100*round($no/($no+$yes),2)); ?>% </td> </tr> </table> The value is sent from the JavaScript, and the following happens: Get the content of the "poll_result.txt" file Put the content of the file in variables and add one to the selected variable Write the result to the "poll_result.txt" file Output a graphical representation of the poll result The Text File The text file (poll_result.txt) is where we store the data from the poll. It is stored like this: 0||0 The first number represents the "Yes" votes, the second number represents the "No" votes. Note: Remember to allow your web server to edit the text file. Do NOT give everyone access, just the web server (PHP). </div> <div class='post-sidebar invisible'> <div class='post-share-buttons post-share-buttons-top'> <div class='byline post-share-buttons goog-inline-block'> <div aria-owns='sharing-popup-Blog1-normalpostsidebar-5576479800649526524' class='sharing' data-title='PHP - AJAX'> <button aria-controls='sharing-popup-Blog1-normalpostsidebar-5576479800649526524' aria-label='Share' class='sharing-button touch-icon-button flat-button ripple' id='sharing-button-Blog1-normalpostsidebar-5576479800649526524' role='button'> Share </button> <div class='share-buttons-container'> <ul aria-hidden='true' aria-label='Share' class='share-buttons hidden' id='sharing-popup-Blog1-normalpostsidebar-5576479800649526524' role='menu'> <li> <span aria-label='Get link' class='sharing-platform-button sharing-element-link' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Get link'> <svg class='svg-icon-24 touch-icon sharing-link'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_link_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Get link</span> </span> </li> <li> <span aria-label='Share to Facebook' class='sharing-platform-button sharing-element-facebook' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=facebook' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to Facebook'> <svg class='svg-icon-24 touch-icon sharing-facebook'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_facebook_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Facebook</span> </span> </li> <li> <span aria-label='Share to X' class='sharing-platform-button sharing-element-twitter' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=twitter' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to X'> <svg class='svg-icon-24 touch-icon sharing-twitter'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_twitter_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>X</span> </span> </li> <li> <span aria-label='Share to Pinterest' class='sharing-platform-button sharing-element-pinterest' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=pinterest' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to Pinterest'> <svg class='svg-icon-24 touch-icon sharing-pinterest'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_pinterest_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Pinterest</span> </span> </li> <li> <span aria-label='Email' class='sharing-platform-button sharing-element-email' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=email' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Email'> <svg class='svg-icon-24 touch-icon sharing-email'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_email_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Email</span> </span> </li> <li aria-hidden='true' class='hidden'> <span aria-label='Share to other apps' class='sharing-platform-button sharing-element-other' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to other apps'> <svg class='svg-icon-24 touch-icon sharing-sharingOther'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_more_horiz_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Other Apps</span> </span> </li> </ul> </div> </div> </div> </div> </div> </div> <div class='post-bottom'> <div class='post-footer'> <div class='post-footer-line post-footer-line-1'> <span class='byline post-icons'> <span class='item-action'> <a href='https://www.blogger.com/email-post/6006907896978318308/5576479800649526524' title='Email Post'> <svg class='svg-icon-24 touch-icon sharing-icon'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_email_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> </a> </span> </span> </div> <div class='post-footer-line post-footer-line-2'> </div> </div> <div class='post-share-buttons post-share-buttons-bottom'> <div class='byline post-share-buttons goog-inline-block'> <div aria-owns='sharing-popup-Blog1-byline-5576479800649526524' class='sharing' data-title='PHP - AJAX'> <button aria-controls='sharing-popup-Blog1-byline-5576479800649526524' aria-label='Share' class='sharing-button touch-icon-button flat-button ripple' id='sharing-button-Blog1-byline-5576479800649526524' role='button'> Share </button> <div class='share-buttons-container'> <ul aria-hidden='true' aria-label='Share' class='share-buttons hidden' id='sharing-popup-Blog1-byline-5576479800649526524' role='menu'> <li> <span aria-label='Get link' class='sharing-platform-button sharing-element-link' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Get link'> <svg class='svg-icon-24 touch-icon sharing-link'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_link_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Get link</span> </span> </li> <li> <span aria-label='Share to Facebook' class='sharing-platform-button sharing-element-facebook' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=facebook' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to Facebook'> <svg class='svg-icon-24 touch-icon sharing-facebook'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_facebook_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Facebook</span> </span> </li> <li> <span aria-label='Share to X' class='sharing-platform-button sharing-element-twitter' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=twitter' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to X'> <svg class='svg-icon-24 touch-icon sharing-twitter'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_twitter_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>X</span> </span> </li> <li> <span aria-label='Share to Pinterest' class='sharing-platform-button sharing-element-pinterest' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=pinterest' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to Pinterest'> <svg class='svg-icon-24 touch-icon sharing-pinterest'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_pinterest_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Pinterest</span> </span> </li> <li> <span aria-label='Email' class='sharing-platform-button sharing-element-email' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=5576479800649526524&target=email' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Email'> <svg class='svg-icon-24 touch-icon sharing-email'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_email_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Email</span> </span> </li> <li aria-hidden='true' class='hidden'> <span aria-label='Share to other apps' class='sharing-platform-button sharing-element-other' data-url='https://myteknohood.blogspot.com/2020/12/php-ajax.html' role='menuitem' tabindex='-1' title='Share to other apps'> <svg class='svg-icon-24 touch-icon sharing-sharingOther'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_more_horiz_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Other Apps</span> </span> </li> </ul> </div> </div> </div> </div> </div> </div> </div> <section class='comments' data-num-comments='0' id='comments'> <a name='comments'></a> <h3 class='title'>Comments</h3> <div id='Blog1_comments-block-wrapper'> </div> <div class='footer'> <a href='https://www.blogger.com/comment/fullpage/post/6006907896978318308/5576479800649526524' onclick='javascript:window.open(this.href, "bloggerPopup", "toolbar=0,location=0,statusbar=1,menubar=0,scrollbars=yes,width=640,height=500"); return false;'> Post a Comment </a> </div> </section> </article> </div> </div><div class='widget PopularPosts' data-version='2' id='PopularPosts1'> <h3 class='title'> Popular posts from this blog </h3> <div role='feed'> <article class='post' role='article'> <div class='post-outer-container'> <div class='post-outer'> <div class='snippet-thumbnail thumbnail-empty'></div> <div class='post-content container'> <div class='post-title-container'> <a name='7387955434870009482'></a> <h3 class='post-title entry-title'> <a href='https://myteknohood.blogspot.com/2020/12/php-xml.html'>PHP XML</a> </h3> </div> <div class='post-header-container container'> <div class='post-header'> <div class='post-header-line-1'> <span class='byline post-timestamp'> <meta content='https://myteknohood.blogspot.com/2020/12/php-xml.html'/> <a class='timestamp-link' href='https://myteknohood.blogspot.com/2020/12/php-xml.html' rel='bookmark' title='permanent link'> <time class='published' datetime='2020-12-28T08:02:00-08:00' title='2020-12-28T08:02:00-08:00'> December 28, 2020 </time> </a> </span> </div> </div> </div> <div class='container post-body entry-content' id='post-snippet-7387955434870009482'> <div class='post-snippet snippet-container r-snippet-container'> <div class='snippet-item r-snippetized'> PHP XML Parsers What is XML? The XML language is a way to structure data for sharing across websites. Several web technologies like RSS Feeds and Podcasts are written in XML. XML is easy to create. It looks a lot like HTML, except that you make up your own tags. If you want to learn more about XML, please visit our XML tutorial. What is an XML Parser? To read and update, create and manipulate an XML document, you will need an XML parser. In PHP there are two major types of XML parsers: Tree-Based Parsers Event-Based Parsers Tree-Based Parsers Tree-based parsers holds the entire document in Memory and transforms the XML document into a Tree structure. It analyzes the whole document, and provides access to the Tree elements (DOM). This type of parser is a better option for smaller XML documents, but not for large XML document as it causes major performance issues. Example of tree-based parsers: SimpleXML DOM Event-Based Parsers Event-based parsers do not hol... </div> <a class='snippet-fade r-snippet-fade hidden' href='https://myteknohood.blogspot.com/2020/12/php-xml.html'></a> </div> </div> <div class='post-bottom'> <div class='post-footer'> <div class='post-footer-line post-footer-line-0'> <div class='byline post-share-buttons goog-inline-block'> <div aria-owns='sharing-popup-PopularPosts1-footer-0-7387955434870009482' class='sharing' data-title='PHP XML'> <button aria-controls='sharing-popup-PopularPosts1-footer-0-7387955434870009482' aria-label='Share' class='sharing-button touch-icon-button flat-button ripple' id='sharing-button-PopularPosts1-footer-0-7387955434870009482' role='button'> Share </button> <div class='share-buttons-container'> <ul aria-hidden='true' aria-label='Share' class='share-buttons hidden' id='sharing-popup-PopularPosts1-footer-0-7387955434870009482' role='menu'> <li> <span aria-label='Get link' class='sharing-platform-button sharing-element-link' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=7387955434870009482&target=' data-url='https://myteknohood.blogspot.com/2020/12/php-xml.html' role='menuitem' tabindex='-1' title='Get link'> <svg class='svg-icon-24 touch-icon sharing-link'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_link_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Get link</span> </span> </li> <li> <span aria-label='Share to Facebook' class='sharing-platform-button sharing-element-facebook' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=7387955434870009482&target=facebook' data-url='https://myteknohood.blogspot.com/2020/12/php-xml.html' role='menuitem' tabindex='-1' title='Share to Facebook'> <svg class='svg-icon-24 touch-icon sharing-facebook'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_facebook_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Facebook</span> </span> </li> <li> <span aria-label='Share to X' class='sharing-platform-button sharing-element-twitter' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=7387955434870009482&target=twitter' data-url='https://myteknohood.blogspot.com/2020/12/php-xml.html' role='menuitem' tabindex='-1' title='Share to X'> <svg class='svg-icon-24 touch-icon sharing-twitter'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_twitter_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>X</span> </span> </li> <li> <span aria-label='Share to Pinterest' class='sharing-platform-button sharing-element-pinterest' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=7387955434870009482&target=pinterest' data-url='https://myteknohood.blogspot.com/2020/12/php-xml.html' role='menuitem' tabindex='-1' title='Share to Pinterest'> <svg class='svg-icon-24 touch-icon sharing-pinterest'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_pinterest_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Pinterest</span> </span> </li> <li> <span aria-label='Email' class='sharing-platform-button sharing-element-email' data-href='https://www.blogger.com/share-post.g?blogID=6006907896978318308&postID=7387955434870009482&target=email' data-url='https://myteknohood.blogspot.com/2020/12/php-xml.html' role='menuitem' tabindex='-1' title='Email'> <svg class='svg-icon-24 touch-icon sharing-email'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_24_email_dark' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Email</span> </span> </li> <li aria-hidden='true' class='hidden'> <span aria-label='Share to other apps' class='sharing-platform-button sharing-element-other' data-url='https://myteknohood.blogspot.com/2020/12/php-xml.html' role='menuitem' tabindex='-1' title='Share to other apps'> <svg class='svg-icon-24 touch-icon sharing-sharingOther'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_more_horiz_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <span class='platform-sharing-text'>Other Apps</span> </span> </li> </ul> </div> </div> </div> <span class='byline post-comment-link container'> <a class='comment-link flat-button ripple' href='https://www.blogger.com/comment/fullpage/post/6006907896978318308/7387955434870009482' onclick='javascript:window.open(this.href, "bloggerPopup", "toolbar=0,location=0,statusbar=1,menubar=0,scrollbars=yes,width=640,height=500"); return false;'> Post a Comment </a> </span> </div> </div> <div class='byline jump-link'> <a class='flat-button ripple' href='https://myteknohood.blogspot.com/2020/12/php-xml.html' title='PHP XML'> Read more </a> </div> </div> </div> </div> </div> </article> </div> </div></div> </main> </div> </div> </div> <aside class='sidebar-container sidebar-invisible' role='complementary'> <div class='navigation container'> <button class='svg-icon-24-button sidebar-back flat-icon-button ripple'> <svg class='svg-icon-24'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_arrow_forward_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> </button> </div> <div class='sidebar section' id='sidebar' name='Sidebar'> <div class='widget BlogArchive' data-version='2' id='BlogArchive1'> <details class='collapsible extendable'> <summary> <div class='collapsible-title'> <h3 class='title'> Archive </h3> <svg class='svg-icon-24 chevron-down'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_expand_more_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> <svg class='svg-icon-24 chevron-up'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_expand_less_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> </div> </summary> <div class='widget-content'> <div id='ArchiveList'> <div id='BlogArchive1_ArchiveList'> <div class='first-items'> <ul class='flat'> <li class='archivedate'> <a href='https://myteknohood.blogspot.com/2020/12/'>December 2020<span class='post-count'>12</span></a> </li> </ul> </div> </div> </div> </div> </details> </div> <div class='widget ReportAbuse' data-version='2' id='ReportAbuse1'> <h3 class='title'> <a class='report_abuse' href='https://www.blogger.com/go/report-abuse' rel='noopener nofollow' target='_blank'> Report Abuse </a> </h3> </div> </div> </aside> </div> <footer class='footer section' id='footer' name='Footer'><div class='widget Attribution' data-version='2' id='Attribution1'> <div class='widget-content'> <div class='blogger'> <a href='https://www.blogger.com' rel='nofollow'> <svg class='svg-icon-24'> <use xlink:href='/responsive/sprite_v1_6.css.svg#ic_post_blogger_black_24dp' xmlns:xlink='http://www.w3.org/1999/xlink'></use> </svg> Powered by Blogger </a> </div> </div> </div></footer> </div> <script type="text/javascript" src="https://resources.blogblog.com/blogblog/data/res/1595758803-rockpool_compiled.js" async="true"></script> <script type="text/javascript" src="https://www.blogger.com/static/v1/widgets/3071540258-widgets.js"></script> <script type='text/javascript'> window['__wavt'] = 'AOuZoY71paXGzSdhESRZaaL5-kc2x9rcng:1752386902232';_WidgetManager._Init('//www.blogger.com/rearrange?blogID\x3d6006907896978318308','//myteknohood.blogspot.com/2020/12/php-ajax.html','6006907896978318308'); _WidgetManager._SetDataContext([{'name': 'blog', 'data': {'blogId': '6006907896978318308', 'title': 'myteknohood', 'url': 'https://myteknohood.blogspot.com/2020/12/php-ajax.html', 'canonicalUrl': 'https://myteknohood.blogspot.com/2020/12/php-ajax.html', 'homepageUrl': 'https://myteknohood.blogspot.com/', 'searchUrl': 'https://myteknohood.blogspot.com/search', 'canonicalHomepageUrl': 'https://myteknohood.blogspot.com/', 'blogspotFaviconUrl': 'https://myteknohood.blogspot.com/favicon.ico', 'bloggerUrl': 'https://www.blogger.com', 'hasCustomDomain': false, 'httpsEnabled': true, 'enabledCommentProfileImages': true, 'gPlusViewType': 'FILTERED_POSTMOD', 'adultContent': true, 'analyticsAccountNumber': '', 'encoding': 'UTF-8', 'locale': 'en-GB', 'localeUnderscoreDelimited': 'en_gb', 'languageDirection': 'ltr', 'isPrivate': false, 'isMobile': false, 'isMobileRequest': false, 'mobileClass': '', 'isPrivateBlog': false, 'isDynamicViewsAvailable': true, 'feedLinks': '\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22myteknohood - Atom\x22 href\x3d\x22https://myteknohood.blogspot.com/feeds/posts/default\x22 /\x3e\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/rss+xml\x22 title\x3d\x22myteknohood - RSS\x22 href\x3d\x22https://myteknohood.blogspot.com/feeds/posts/default?alt\x3drss\x22 /\x3e\n\x3clink rel\x3d\x22service.post\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22myteknohood - Atom\x22 href\x3d\x22https://www.blogger.com/feeds/6006907896978318308/posts/default\x22 /\x3e\n\n\x3clink rel\x3d\x22alternate\x22 type\x3d\x22application/atom+xml\x22 title\x3d\x22myteknohood - Atom\x22 href\x3d\x22https://myteknohood.blogspot.com/feeds/5576479800649526524/comments/default\x22 /\x3e\n', 'meTag': '', 'adsenseHostId': 'ca-host-pub-1556223355139109', 'adsenseHasAds': false, 'adsenseAutoAds': false, 'boqCommentIframeForm': true, 'loginRedirectParam': '', 'view': '', 'dynamicViewsCommentsSrc': '//www.blogblog.com/dynamicviews/4224c15c4e7c9321/js/comments.js', 'dynamicViewsScriptSrc': '//www.blogblog.com/dynamicviews/0a879ddeb6094a4d', 'plusOneApiSrc': 'https://apis.google.com/js/platform.js', 'disableGComments': true, 'interstitialAccepted': false, 'sharing': {'platforms': [{'name': 'Get link', 'key': 'link', 'shareMessage': 'Get link', 'target': ''}, {'name': 'Facebook', 'key': 'facebook', 'shareMessage': 'Share to Facebook', 'target': 'facebook'}, {'name': 'BlogThis!', 'key': 'blogThis', 'shareMessage': 'BlogThis!', 'target': 'blog'}, {'name': 'X', 'key': 'twitter', 'shareMessage': 'Share to X', 'target': 'twitter'}, {'name': 'Pinterest', 'key': 'pinterest', 'shareMessage': 'Share to Pinterest', 'target': 'pinterest'}, {'name': 'Email', 'key': 'email', 'shareMessage': 'Email', 'target': 'email'}], 'disableGooglePlus': true, 'googlePlusShareButtonWidth': 0, 'googlePlusBootstrap': '\x3cscript type\x3d\x22text/javascript\x22\x3ewindow.___gcfg \x3d {\x27lang\x27: \x27en_GB\x27};\x3c/script\x3e'}, 'hasCustomJumpLinkMessage': false, 'jumpLinkMessage': 'Read more', 'pageType': 'item', 'postId': '5576479800649526524', 'postImageUrl': 'poll.gif', 'pageName': 'PHP - AJAX', 'pageTitle': 'myteknohood: PHP - AJAX', 'metaDescription': ''}}, {'name': 'features', 'data': {}}, {'name': 'messages', 'data': {'edit': 'Edit', 'linkCopiedToClipboard': 'Link copied to clipboard', 'ok': 'Ok', 'postLink': 'Post link'}}, {'name': 'template', 'data': {'name': 'Notable', 'localizedName': 'Notable', 'isResponsive': true, 'isAlternateRendering': false, 'isCustom': false, 'variant': 'rockpool_deep_warm_grey', 'variantId': 'rockpool_deep_warm_grey'}}, {'name': 'view', 'data': {'classic': {'name': 'classic', 'url': '?view\x3dclassic'}, 'flipcard': {'name': 'flipcard', 'url': '?view\x3dflipcard'}, 'magazine': {'name': 'magazine', 'url': '?view\x3dmagazine'}, 'mosaic': {'name': 'mosaic', 'url': '?view\x3dmosaic'}, 'sidebar': {'name': 'sidebar', 'url': '?view\x3dsidebar'}, 'snapshot': {'name': 'snapshot', 'url': '?view\x3dsnapshot'}, 'timeslide': {'name': 'timeslide', 'url': '?view\x3dtimeslide'}, 'isMobile': false, 'title': 'PHP - AJAX', 'description': '', 'featuredImage': 'https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t6ZAgD7Aj8a7zE7lRG9O9Dm_m5UONeLArYNY1Z47JmRNbeAzwersE5wHtaEoh3vZw', 'url': 'https://myteknohood.blogspot.com/2020/12/php-ajax.html', 'type': 'item', 'isSingleItem': true, 'isMultipleItems': false, 'isError': false, 'isPage': false, 'isPost': true, 'isHomepage': false, 'isArchive': false, 'isLabelSearch': false, 'postId': 5576479800649526524}}, {'name': 'widgets', 'data': [{'title': 'myteknohood (Header)', 'type': 'Header', 'sectionId': 'header', 'id': 'Header1'}, {'type': 'BlogArchive', 'sectionId': 'sidebar', 'id': 'BlogArchive1'}, {'title': '', 'type': 'ReportAbuse', 'sectionId': 'sidebar', 'id': 'ReportAbuse1'}, {'title': 'Search This Blog', 'type': 'BlogSearch', 'sectionId': 'search_top', 'id': 'BlogSearch1'}, {'title': '', 'type': 'FeaturedPost', 'sectionId': 'page_body', 'id': 'FeaturedPost1', 'postId': '5576479800649526524'}, {'title': 'Blog Posts', 'type': 'Blog', 'sectionId': 'page_body', 'id': 'Blog1', 'posts': [{'id': '5576479800649526524', 'title': 'PHP - AJAX', 'featuredImage': 'https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t6ZAgD7Aj8a7zE7lRG9O9Dm_m5UONeLArYNY1Z47JmRNbeAzwersE5wHtaEoh3vZw', 'showInlineAds': true}], 'headerByline': {'regionName': 'header1', 'items': [{'name': 'timestamp', 'label': ''}]}, 'footerBylines': [{'regionName': 'footer1', 'items': [{'name': 'share', 'label': ''}, {'name': 'comments', 'label': 'comments'}, {'name': 'labels', 'label': 'Labels:'}, {'name': 'icons', 'label': ''}]}, {'regionName': 'footer3', 'items': [{'name': 'location', 'label': 'Location:'}]}], 'allBylineItems': [{'name': 'timestamp', 'label': ''}, {'name': 'share', 'label': ''}, {'name': 'comments', 'label': 'comments'}, {'name': 'labels', 'label': 'Labels:'}, {'name': 'icons', 'label': ''}, {'name': 'location', 'label': 'Location:'}]}, {'title': '', 'type': 'PopularPosts', 'sectionId': 'page_body', 'id': 'PopularPosts1', 'posts': [{'title': 'PHP - AJAX', 'id': 5576479800649526524}, {'title': 'PHP XML', 'id': 7387955434870009482}]}, {'type': 'Attribution', 'sectionId': 'footer', 'id': 'Attribution1'}]}]); _WidgetManager._RegisterWidget('_HeaderView', new _WidgetInfo('Header1', 'header', document.getElementById('Header1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogArchiveView', new _WidgetInfo('BlogArchive1', 'sidebar', document.getElementById('BlogArchive1'), {'languageDirection': 'ltr', 'loadingMessage': 'Loading\x26hellip;'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_ReportAbuseView', new _WidgetInfo('ReportAbuse1', 'sidebar', document.getElementById('ReportAbuse1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogSearchView', new _WidgetInfo('BlogSearch1', 'search_top', document.getElementById('BlogSearch1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_FeaturedPostView', new _WidgetInfo('FeaturedPost1', 'page_body', document.getElementById('FeaturedPost1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'page_body', document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'https://www.blogger.com/static/v1/jsbin/3155575284-lbx__en_gb.js', 'lightboxCssUrl': 'https://www.blogger.com/static/v1/v-css/123180807-lightbox_bundle.css'}, 'displayModeFull')); _WidgetManager._RegisterWidget('_PopularPostsView', new _WidgetInfo('PopularPosts1', 'page_body', document.getElementById('PopularPosts1'), {}, 'displayModeFull')); _WidgetManager._RegisterWidget('_AttributionView', new _WidgetInfo('Attribution1', 'footer', document.getElementById('Attribution1'), {}, 'displayModeFull')); </script> </body> </html>