Dear All,
I use ajax to fetch data, ie & chrome work well, but in firefox,
the dev_appserver prompt just be filled with
continuous http request( response code 200), but nothing in firefox.
could anybody tell me the reason?
Thanks a lot!
here is in-html code:
function init() {
var ops = {
method: "POST",
params: "uid=agdzaGFyZWt1cg0LEgdTS19Vc2VyGAEM"
}
var loader = new lib.Loader( "/ajax/test_Ajax", onload, ops );
loader.load();
}
function onload() {
document.getElementById( "holder" ).innerHTML =
this.request.responseText;
}
here is my ajax lib, problem maybe in init() and load():
var lib = {}
function $( id ) {
return document.getElementById( id );
}
var Class = {
create: function() {
return function() {
this.init.apply( this, arguments );
}
}
}
Object.prototype.expand = function( source ) {
for( var property in source ) {
this[ property ] = source[ property ];
}
return this;
}
//------------------------------------------------------------------------------
lib.Loader = Class.create();
lib.Loader.prototype = {
init: function( url, onload, options ) {
if( arguments.length < 2 ) {
alert( "need url & onLoad() at least" );
return;
}
if( window.XMLHttpRequest ) {
this.request = new XMLHttpRequest();
} else if( window.ActiveXObject ) {
var vsn = [ "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0",
"MSXML2.XMLHTTP.3.0", "MSXML2.XmlHttp",
"Microsoft.XmlHttp" ];
for( var i = 0; i < vsn.length; i++ ) {
try{
this.request = new ActiveXObject( vsn[
i ] );
break;
} catch( e ) {}
}
}
if( !this.request ) {
alert( "no XMLHTTP implementation" );
return;
}
this.options = new Object();
this.options.expand( this.defaults );
this.options.expand( options );
window.defaultStatus = this.options.onLoadStatus;
this.$type = "Loader";
this.url = url;
this.onload = onload;
},
defaults: {
onerror: null,
method: "GET",
params: null,
contentType: "application/x-www-form-urlencoded",
onLoadStatus: "start...",
onFinishStatus: "done",
isAsync: true,
user: null,
password: null
},
defaultError: function() {
alert( "<DEFAULT ERROR HANDLER>" );
},
load: function() {
if( this.request ) {
var op = this.options;
try {
var loader = this;
this.request.onreadystatechange = function() {
loader.onReadyState.call( loader );
}
this.request.open( op.method, this.url,
op.isAsync, op.user,
op.password );
this.request.setRequestHeader( "Content-Type",
op.contentType );
this.request.send( op.params );
} catch( error ) {
$call( this.options.onerror );
}
}
},
onReadyState: function() {
if( this.request.readyState == 4 ) {
if( ( this.request.status >= 200 &&
this.request.status <= 300 ) ||
this.request.status == 0 ) {
window.defaultStatus =
this.options.onFinishStatus;
this.onload.call( this );
}
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---