PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Md Fazle Yea Bari Hossain   A Simple Sloganizer   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: this is the page where AJAX is used to get the slogans and display it
Class: A Simple Sloganizer
Generate slogan phrases from given keywords
Author: By
Last change:
Date: 16 years ago
Size: 1,345 bytes


Class file image Download
<script language="javascript" type="text/javascript">
//Browser Support Code
function ajaxFunction(){
    var ajaxRequest; // The variable that makes Ajax possible!
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLHttpRequest();
    } catch (e){
        // Internet Explorer Browsers
            ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e){
                // Something went wrong
                alert("Your browser broke!");
                return false;
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            var ajaxDisplay = document.getElementById('ajaxDiv');
            ajaxDisplay.innerHTML = ajaxRequest.responseText;
    var keyword = document.getElementById('keyword').value;
    var queryString = "?key=" + keyword;"GET", "sloganizer.php" + queryString, true);
<div id='ajaxDiv' align="center">The Slogans will be displayed here</div>
<div align="center">
    <input type="text" id="keyword"><br>
    <input type='button' onclick='ajaxFunction()' value='Sloganize'>