Jump to content

Type Mismatch


Recommended Posts

Almost there! made a new topic because the original question of my last was solved, leaving me with but one error.

 

I'm getting type mismatch which is an error with the onreadystatechange but I cant seem to fix it  ???

 

can anyone sift through this and tell me if I'm doing anything wrong?

 

function GetAjax() { 
            try {
                return new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) { }
    
            try {
                return new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (E) { }
            
            if (typeof XMLHttpRequest != 'undefined') {
                return new XMLHttpRequest();
            }
            
            throw new Exception('No AJAX support');
        }
        
function new_cont(url) {
                var aobj = GetAjax();
                aobj.open('GET', url, true); 
			aobj.onreadystatechange = HandleSendResponse();
			aobj.send(null);

        }
        
function HandleSendResponse() {
      
      document.getElementById("pcatchd").innerHTML = GetAjax.responseText;

}

 

Thanks guys

Link to comment
Share on other sites

Don't take this the wrong way, but based on a few of your posts, maybe you should look into the basics of JavaScript again.

 

 

 

Anyway,

 

aobj.onreadystatechange = HandleSendResponse();

 

Should be aobj.onreadystatechange = HandleSendResponse;

 

When ever you put a function, it makes the callback the return of the function.

 

For example:

 

func1() { return "func2"; }
func2() { }
var somevar = func1();
//somevar is now func2....




Also,

document.getElementById("pcatchd").innerHTML = GetAjax.responseText;

Where exactly is GetAjax set?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.