javascript - jQuery ajax call getting error response with status of 200 -


i sent jquery ajax request express-powered node.js server, processed , responded. however, response triggers ajax error callback instead of success callback (despite status code being "200"). not expecting. ;o) here code:

client.js:

$.ajax( {     url: "/httpupload",     type: "post",     processdata: false,     contenttype: false,     datatype : "json",     data: formdata,     success: function() {         // stuff     },     error: function( error ) {         console.error( "httpupload failed: " + error.responsetext );     } } ); 

server.js:

var express = require( "express" ); var app = express(); var server = require( "http" ).server( app ); var multipart = require('connect-multiparty');  app.use( express.static( "public" ) ); app.use( multipart() );  app.post( "/httpupload", function( req, res ) {     console.log( "received post request");     res.send( "done!" ); } 

the error object in ajax error callback looks this:

{readystate: 4, responsetext: "done!", status: 200, statustext: "ok"} 

any idea why it's triggering error callback?

oh, silly me. it's datatype had on ajax call. wasn't returning json, errored out. worked when removed that.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

javascript - How to bind ViewModel Store to View? -

javascript - Solution fails to pass one test with large inputs? -