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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:28:47+00:00 2026-06-10T01:28:47+00:00

I am doing a simple Ajax call which is working in ASP.NET but is

  • 0

I am doing a simple Ajax call which is working in ASP.NET but is failing with some weird DOM Exception when you put a breakpoint inside the onreadystatechange function. What is the extra header magic ASP.NET is doing that PHP is failing to do causing the responseText to be blank for PHP only with the DOM Exceptions when you look into the xmlhttp variable in Google Chrome for example.

var xmlhttp;
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        //Here is where you unwrap the data
        var arr = UnWrapVars(xmlhttp.responseText);
        if (callBackFunc) {
            callBackFunc(arr);
        }
    }
};
xmlhttp.open("POST", ajaxURL, true);
if (navigator.userAgent.toLowerCase().indexOf('msie') == -1) {
    xmlhttp.overrideMimeType("application/octet-stream");
}
xmlhttp.send("[FunctionName]" + functionName + "[/FunctionName][CanvasID]" + canvasid + "[/CanvasID][WindowID]" + windowid.toString() + "[/WindowID][Vars]" + getEncodedVariables() + "[/Vars]");

The incoming data from the Ajax page is like:
[root][Vars][windows]

I am intentionally doing [ and not < so please dont point that out and again it works from an ASP.NET page but not from a PHP page. Data returned is the same I have checked server side. So what is the missing header magic if any ASP.NET does that PHP isnt doing.

  • 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-10T01:28:48+00:00Added an answer on June 10, 2026 at 1:28 am

    This is because the $_POST is actually shorthand for accessing data which was posted through form. It expects the appropriate header. Put this line before the xmlhttp.send():

    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    

    This will force PHP to populate the $_POST array.

    Alternatively you could create a Request instance, which acts as custom wrapper for php://input stream. Then your XHR calls would not need to send the additional header.

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

Sidebar

Related Questions

I'm doing a simple ajax query which retrieves a variable-length list of values as
So i've been doing quite a simple ajax call to grab my photo albums
I have encountered a unique problem. I am doing a simple ajax call using
I'm doing some simple tests (in preparation for a larger project) to call an
I've made a simple implementation of an autocomplete which would call ajax and load
I'm trying to do a simple AJAX call to an ASP page, that resets
I ran into a very vague error while doing some simple jQuery DOM manipulation.
I'm trying to make a simple AJAX call to the Justin TV API, which
Im doing a simple ajax request like:` $.ajax({ type: 'POST', url: 'http://' + serverIP
I am doing a simple $.ajax request: $.ajax({ type: POST, url: /Run/ + param1

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.