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
https://forums.phpfreaks.com/topic/116900-type-mismatch/
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
https://forums.phpfreaks.com/topic/116900-type-mismatch/#findComment-601265
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.