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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:47:19+00:00 2026-05-15T18:47:19+00:00

Please Note: answers along the lines of ‘use jquery’ or ‘use (insert wellknown framework)’

  • 0

Please Note: answers along the lines of ‘use jquery’ or ‘use (insert wellknown framework)’ is not helpful. Frameworks such as jquery includes alot of extra code which is not nessary at all for what I am doing. ‘But, you can include one from Google’, yes that may be the case, but I prefer to keep to my own code. With that in mind, lets proceed to the problem….

I have an ajax call which doesn’t pass POST vars through on IE7/IE8, but only on odd occasions. It appears to be extremely random and the majority of the time it does work.

I am had a look at jquery and cannot see much difference in the way it works compared to this custom one.

Here is the ajax function:

function GetXmlHttpObject(handler){ 
  var objxml = null;
 if(handler==null) {
  handler = function() {}
 }

   var ProgID = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];              

     try {  
         objxml = new XMLHttpRequest();  
     }  
     catch(e) {  
         for (var i = 0; i < ProgID.length; i++){  
             try {  
                 objxml = new ActiveXObject(ProgID[i]);  
             }  
             catch(e) {  
                 continue;  
            }  
         }  
     } 
 objxml.onreadystatechange=handler;

     return objxml;  
}

A function that calls the Ajax function would be like this:

function sample_ajax(object_type,object_id) {
 var d = new Date();
 var time = d.getTime();
 var url= MYSITEURL + "my_ajax_script.php?timestamp="+time;

 params = "object_type="+object_type+"&object_id="+object_id;
 xmlHttp_comment_notifyreset = GetXmlHttpObject(sample_ajax_helper);//fails on safari 1
 xmlHttp_comment_notifyreset.open("POST", url , true);

 xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "no-cache");
 xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "no-store");
 xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "must-revalidate");
 xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "post-check=0");
 xmlHttp_comment_notifyreset.setRequestHeader("Cache-Control", "pre-check=0");
 xmlHttp_comment_notifyreset.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");


 xmlHttp_comment_notifyreset.setRequestHeader("Content-Type", "application/x-www-form-URLencoded");
 xmlHttp_comment_notifyreset.setRequestHeader("Content-Length", params.length);
 xmlHttp_comment_notifyreset.setRequestHeader("Connection", "close");

 xmlHttp_comment_notifyreset.send(params);
}

I am had a look at jquery and cannot see much difference in the way it works compared to this custom one.

  • 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-15T18:47:20+00:00Added an answer on May 15, 2026 at 6:47 pm

    If the params are only failing to be sent sometimes, the problem may be in this line:

    params = "object_type="+object_type+"&object_id="+object_id;
    

    The params are not being escaped. Try this:

    params = "object_type=" +
             encodeURIComponent(object_type) +
             "&object_id=" +
             encodeURIComponent(object_id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please note my homework tag. As with all homework, helpful suggestions over straight answers
Please note - I am not looking for the right way to open/read a
Please note: This is a question about the Eclipse plugin Subversive , and not
Please note this is not a question about online/hosted SVN services. I am working
Please note that this is not homework and i did search before starting this
Please note that I'm referring to 3-layer (logical layering) and not 3-tier (physical). Also
Please note that I have already been through similar questions and their answers here
Please note : this is an ancient question with ancient answers. Most of the
PLEASE NOTE: I've answered my own question with a link to an answer to
Please note, sarnold has heavily edited the question; the original question, in its entirety,

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.