JQuery Ajax Returning Blank Page but manual xmlhttprequest works fine -


i tried jquery on particular page on forums

$.get("/members/", function(data) { alert(data); }); 

but return blank page. however, if use xmlhttprequest object own code, grabs html page fine:

xhr({method: "get", url: "/members/", onload: function(responsedetails) { if (responsedetails.status == 200) { alert(responsedetails.responsetext); }}}); 

intestingly, used jquery on page , worked fine:

$.get("/stats/", function(data) { alert(data); }); 

in case, explain what's going on , how can fix this? i'd rather not have long stupid section of code custom xhr method:

function xhr(details) { try {var xmlhttp = new xmlhttprequest();} catch (e) { var xmlhttp_ids = new array('msxml2.xmlhttp.5.0','msxml2.xmlhttp.4.0', 'msxml2.xmlhttp.3.0', 'msxml2.xmlhttp', 'microsoft.xmlhttp' ); var success = false; (var i=0;i < xmlhttp_ids.length && !success; i++) {     try {     var xmlhttp = new activexobject(xmlhttp_ids[i]);     success = true;         } catch (e) {} } if (!success) throw new error('unable create xmlhttprequest.'); }  xmlhttp.onreadystatechange = function() { var responsestate = {             responsetext:(xmlhttp.readystate==4 ? xmlhttp.responsetext : ''),             readystate:xmlhttp.readystate,             status:(xmlhttp.readystate==4 ? xmlhttp.status : 0)         }         if (details["onreadystatechange"]) {             details["onreadystatechange"](responsestate);         }         if (xmlhttp.readystate==4) {             if (details["onload"] && xmlhttp.status>=200 && xmlhttp.status<300) {                 details["onload"](responsestate);             }             if (details["onerror"] && (xmlhttp.status<200 || xmlhttp.status>=300)) {                 details["onerror"](responsestate);             }         }     }     try {       xmlhttp.open(details.method, details.url);     } catch(e) {       if( details["onerror"] ) {         details["onerror"]({responsexml:'',responsetext:'',readystate:4,responseheaders:'',status:403,statustext:'forbidden'});       }       return;     }     if (details.headers) {         (var prop in details.headers) {             xmlhttp.setrequestheader(prop, details.headers[prop]);         }     }     xmlhttp.send((typeof(details.data)!='undefined')?details.data:null); } 

thanks! (hopefully it's not problem how forum page set up, since it's hosted forums, not own.)

edit: response headers on xhr call

date    sat, 30 apr 2011 01:21:54 gmt server  apache cache-control   no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0 pragma  no-cache expires mon, 26 jul 1997 05:00:00 gmt content-encoding    gzip vary    accept-encoding content-length  7723 connection  close content-type    text/html; charset=utf-8 

response headers on failed jquery call

date    sat, 30 apr 2011 01:23:38 gmt server  apache content-encoding    gzip vary    accept-encoding content-length  26 connection  close content-type    text/html; charset=iso-8859-1 


Comments