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 - I am not looking for the right way to open/read a
Please note the Edit below for a lot more information, and a possible solution
Please note: In each step I describe below I'm logged in as the same
How do I print debug messages in the Google Chrome JavaScript Console? Please note
Please read the whole question. I'm not looking for an approach to managing multi-lingual
Please give me the direction of the best guidance on the Entity Framework.
Please suggest some good resources to start writing Java Web services.
Please consider this example class: [Serializable] public class SomeClass { private DateTime _SomeDateTime; public
Please bear with me, I'm just learning C++. I'm trying to write my header
Please explain to me why the very last echo statement is blank? I expect

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.