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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:35:03+00:00 2026-05-21T07:35:03+00:00

function a (){ var b = null; if(window.XMLHttpRequest) b = new XMLHttpRequest(); else if(window.ActiveXObject)

  • 0
function a (){
    var b = null;
    if(window.XMLHttpRequest) b = new XMLHttpRequest();
    else if(window.ActiveXObject) b = new ActiveXObject("Microsoft.XMLHTTP");
    if(!b) b = new ActiveXObject("msxml2.XMLHTTP");
    return b;
}
var b=a();
function c(){
    var u = "ajax3_php.php?w="+ parseInt(Math.random()*88888);
    b.onreadystatechange = function (){
        if(b.status == 200 && b.readyState == 4){
            document.getElementById("divid").innerHTML = b.responseText;
        }
    }
    b.open("get", u, true);
    b.send();
}

And on the target page “ajax3_php.php”:

<?php
echo "OK";
?>

And on “divid” id
<div id=”divid”>Test</div>

the error message is:

Message: Unspecified error.
Line: 20
Char: 3
Code: 0
URI: http://localhost/lat1/ajax/ajax3.php

The shocking part is, this is on line 20:

if(b.status == 200 && b.readyState == 4){

What is wrong with that?

FYI : firebug says nothing.

  • 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-21T07:35:04+00:00Added an answer on May 21, 2026 at 7:35 am

    This code seemed to do the trick.

    function a()
    {
        var b = null;
        if(window.XMLHttpRequest)
        {
            b = new XMLHttpRequest();
        }else if(window.ActiveXObject)
        {
            b = new ActiveXObject("Microsoft.XMLHTTP");
        }
        if(!b)
        {
            b = new ActiveXObject("msxml2.XMLHTTP");
        }
        return b;
    }
    var b = a();
    function c()
    {
        var u = "ajax3_php.php?w="+ parseInt(Math.random()*88888, 10);
        b.open("get", u, true);
        b.onreadystatechange = function ()
        {
            if(b.readyState === 4)
            {
                if(b.status === 200)
                {
                    if(b.responseText)
                    {
                        document.getElementById("divid").innerHTML = b.responseText;
                    }
                }   
            }
        };
        b.send();
    }
    
    c();
    

    I don’t have a silver bullet answer as to why the error was popping up, but the call to b.status was throwing an error when the readyState wasn’t 4. However, that particular error was one I ran into recently (but a different error type) when sending an empty string via innerHTML to an element in IE 8 (I suspected your responseText was empty, causing the error).

    I took the liberty of fixing that code for you (along with a few other touches). There are no errors in IE 7-8, Quirks or none.

    I hope this helps you.

    -Matt

    EDIT: I stumbled upon this MSDN post. It’s curious to see that their example code uses nested if blocks just like I did, yet no explanation. I’ll investigate further.

    Link: http://msdn.microsoft.com/en-us/library/dd576252%28v=vs.85%29.aspx

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

Sidebar

Related Questions

var name = #floatMenu; var menuYloc = null; $(document).ready(function () { menuYloc = parseInt($(name).css(top).substring(0,
For example: (function() { var proxied = window.eval; window.eval = function() { return proxied.apply(this,
I have this javascript: function createRequestObject(){ var req; if(window.XMLHttpRequest){ //For Firefox, Safari, Opera req
I have this code somewhere in my plugin: $('tr', $this).hover(function(){ var cur_color = null;
var Dog = function() { var _instance = 'hello world'; return function() { console.log(this._instance);
$(a.close).click(function() { var id = $(this).attr(id); alert(id); $(this).parents(div.venue:first).fadeOut(Fast); return false; }); Any ideas why
function sc_HTMLParser(aHTMLString){ var parseDOM = content.document.createElement('div'); parseDOM.appendChild(Components.classes['@mozilla.org/feed-unescapehtml;1'] .getService(Components.interfaces.nsIScriptableUnescapeHTML) .parseFragment(aHTMLString, false, null, parseDOM)); return parseDOM;
$(function() { var number = document.getElementById(breuken); var i=0; for (i=1;i<=10;i++){ var fRandom = Math.floor(Math.random()*10);
$('#types').change(function() { var htmlToAppend = <br/><input id='btnAddDictionary' type='button' value='Add Dictionary' />; if ($(#types).val() ==
$(.sectionHeader).click(function() { var row = $(this).parent(); while (row.next().length != 0) { row = row.next();

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.