ajax - jQuery aspx error function always called, even with apparently valid return data -


i making call using jquery (jquery-1.5.2.min.js). server receives call. shows response text coming apparently correct. in javascript error: function called instead of success: function, , data of parameters error function don't give clue problem.

here's function make initial call:

function selectcbgatclickedpoint() {     $.ajax( {         type: "get",         datatype: "text",         url: "http://localhost/ajax/selectcbgatpoint/1/2",         success:             function( msg )             {                 alert( "success: " + msg );             },         error:             function( jqxhr, textstatus, errorthrown )             {                 alert( "error: " + jqxhr + textstatus + errorthrown );             }     } ); } 

here's function handle call in server code:

def ajax( ajax, *args ):     lock:         print "ajax request received: " + str( args )          cherrypy.response.headers[ "content-type" ] = "application/text"          return "{ x: 0 }" 

cherrypy odd beast, , thinking problem must lie there. say, see both query go out , response come in fiddler. here fiddler shows raw view of response:

http/1.1 200 ok date: mon, 11 apr 2011 17:49:25 gmt content-length: 8 content-type: application/text server: cherrypy/3.2.0  { x: 0 } 

looks good, in javascript, error: function, following values parameters (as shown in ):

errorthrown = "" jqxhr = object { readystate=0, status=0, statustext="error"} statustext = "error" 

i don't know word "error" coming from. string not appear anywhere in cherrypy server code.

note though i'm returning json string i've set send , receive types "text" now, simplify in order isolate problem.

any ideas why i'm getting "error" reply, when errorthrown empty? haven't "initialized" either jquery or jquery.ajax?

my problem same m katz, had browser pointed file:///c:/temp.html , jquery considering request cross domain. however, setting crossdomain property true had no effect. had move page under web project, once did magically started work.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -