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 7984221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:12:00+00:00 2026-06-04T11:12:00+00:00

I am trying to initiate an ajax post call to a php script where

  • 0

I am trying to initiate an ajax post call to a php script where it will update some values in my database.

The problem I have is, the POST values are not seen in my php script, or at least I have no response.

Here is my javascript:

<script type="text/javascript">
$("btnOpsb" ).onclick = pinOpsb;
function pinOpsb(){
var params = "wxdata = test";
var ajaxRequest;
try{ajaxRequest = new XMLHttpRequest();} catch (e){try{ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try{ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");} catch (e){alert("Error: Browser/Settings conflict");return false;}}}
    ajaxRequest.onreadystatechange = function(){
        if(ajaxRequest.readyState == 4){
            alert(ajaxRequest.responseText);
        }
    }
    ajaxRequest.open("POST","wx2strip.php",true);
    ajaxRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    ajaxRequest.send("fname=Henry&lname=Ford");
}
</script>

In my wx2strip.php I have tried echo back something if $_POST had anything in it, but even when I just echo something at the top of the script and exit, there is still no response in the alert I created.

I tried using get, and I do get a response back.

Any help would be appreciated, thanks.

  • 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-06-04T11:12:01+00:00Added an answer on June 4, 2026 at 11:12 am

    Add these two lines to set the right headers:

    ajaxRequest.setRequestHeader("Content-length", "fname=Henry&lname=Ford".length);
    ajaxRequest.setRequestHeader("Connection", "close");
    

    Content-length is required for POST.

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

Sidebar

Related Questions

My jquery scripts have some php in them to initiate variables, etc. I'm trying
Trying to get comfortable with jQuery and I have encountered some sample code that
I'm trying to initiate an ajax request whenever a person changes the value of
I am really suffering here trying to get this ajax call to work, sorry
I'm trying to initiate a call from within an iPhone app. This related code
I am trying to use a main,java to initiate 3 tabs, and have each
I am trying to parse some data from external site to local script. Local
Here is what I am trying to do. I have a perl script that
I'm trying to initiate a call on the iPhone with the tel url that
I am trying to use the mq_notify call to initiate a thread with POSIX

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.