Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6672799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:33:02+00:00 2026-05-26T03:33:02+00:00

<script language=’javascript’ type=’text/javascript’> function ajaxFunction(){ var ajaxRequest; try{ // Opera 8.0+, Firefox, Safari ajaxRequest

  • 0
 <script language='javascript' type='text/javascript'>

function ajaxFunction(){
  var ajaxRequest;  

  try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
 } catch (e){
    // Internet Explorer Browsers
    try{
        ajaxRequest = new ActiveXObject('Msxml2.XMLHTTP');
    } catch (e) {
        try{
            ajaxRequest = new ActiveXObject('Microsoft.XMLHTTP');
        } catch (e){
            // Something went wrong
            alert('Your browser broke!');
            return false;
        }
    }
  }
  ajaxRequest.onreadystatechange = function(){
    if(ajaxRequest.readyState == 4){
        var ajaxDisplay = document.getElementById('pagecomments');
        ajaxDisplay.innerHTML = ajaxRequest.responseText;

    }
  }
  var message = document.getElementById('message').value;
  var wpm = document.getElementById('wpm').value;
  var queryString = '?message=' + message + '&wpm=' + wpm;
  request.open("POST", ajaxprofilechat.php, true);  
  http.send(null); 

  }

  </script>

Hi, I am trying to convert this script that I have from the ajax GET method to POST method, as I think that it will solve one of the problems that I am having on my website. However, I am very, very novice in ajax coding and although I have attempted to convert to POST, there is an error because this script is not working. Could someone who is good with ajax please help me fix this problem that I have? All I want this to do is to work using the POST method. Do I even need to use variable and query strings when using POST? Any help would be greatly appreciated. Thanks for your time!

Here is ajaxprofilechat

mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname);
$age = $_POST['message'];
$wpm = $_POST['wpm'];
$age = mysql_real_escape_string($age); 
$wpm = mysql_real_escape_string($wpm);
$chatname6 = ($_SESSION['username']);
$message6 = $_GET['site_message'];
$month6 = date("F");
$dayofmonth6 = date("d");
$year6 = date("Y");
$date10 = "$month6 $dayofmonth6 $year6";
$hours6 = date("g");
  $min6 = date("i");
 $sec6 = date("s");
 $amorpm6 = date("A");
 $time6 = "$hours6:$min6 $amorpm6";

 if (strlen($age)>4)
 {
 mysql_query("INSERT INTO guestbook VALUES        ('','$wpm','$chatname6','$age','$date10','$time6')");
echo "&nbsp;<h80><b>Comment Posted</b></h80><p><p>";
}
else
 {
 echo "&nbsp;<h80><b>Your comment must be greater than four characters</b></h80><p>";
 }
 ?> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:33:03+00:00Added an answer on May 26, 2026 at 3:33 am

    as Gus said correct the ajaxprofilechat.php .

    ajaxRequest.open("POST", 'ajaxprofilechat.php', true);
    

    plz you note you are using different ajax objects each time , you have to stick with the object ajaxRequest .

    then make sure you send your params this way :

    var params= 'message=' + message + '&wpm=' + wpm;
      ajaxRequest.open("POST", 'ajaxprofilechat.php', true);  
      ajaxRequest.send(params);
    

    also add this line before the send

    ajaxRequest.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    

    also try to make things simple to make sure everything is working use hard coded values in the first time :

    var message = 'test';
      var wpm = 'test';
    

    also use chrome developper tools or firebug to see errors details ,
    hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

See example: <!DOCTYPE html> <html> <head> <title>language</title> <script type=text/javascript src=http://www.google.com/jsapi> </script> </head> <body> <div
I have this simple code that speaks for itself. <script language='javascript"> function check() {}
<SCRIPT Language = JavaScript> function calculate() { a = 12 b = eval(document.form.number.value) c
I'm using script language ChaiScript with c++ and Qt. I've defined such function: void
I have this script on my html page: <script language='javascript'>parent.resizeTo(550,510);</script> I'd like to add
I'm registering a javascript in aspx.net Dim script = <script language = javascript> &
I have written a simple brainfuck interpreter in MATLAB script language. It is fed
Does anybody have a PHP (or other language) script for drawing a spiral. A
What language and libraries are suitable for a script to parse and download small
I have some script in my default page that redirects users to language specific

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.