0

ajax done doesnt fire when receive json file. it prints json object out client side

$.ajax({
                type: "POST",
                url: url,
                processData: false,
                dataType: 'json',
                contentType: 'application/json',
                data: data
            }).done(function() {
                console.log( "Sample of data:");
                alert("hello");
            }).fail(function()  {
                console.log("ajax failed ");
            });

on service side, I got json file from client

 def post(self):
    print self.request.body
    print tornado.escape.json_encode(self.request.body)
    self.set_header("Content-Type", "application/json")
    self.write("{}")

on browser , I didnt see any error code. i get 200. but console output "ajax failed" please help

cppython
  • 1,209
  • 3
  • 20
  • 30

1 Answers1

0

why not use:

$.ajax({
         type: "POST",
         url: url,
         processData: false,
         dataType: 'json',
         contentType: 'application/json',
         data: data,
         success: function(){
             console.log( "Sample of data:");
             alert("hello");
               },
         error: function()  {
            console.log("ajax failed ");
           }
       });
atomCode
  • 842
  • 7
  • 17