Invalid json response when using devise plugin

Hey all,

I am using devise. While the data successfully updates to database, it
still reports back as an error, and the below error function is
executed:

      var options = {
        type: 'POST',
        url: "/user",
        dataType: 'json',
        data: $('#dialog-form form:first').serialize(),
        error: function(xhr, textStatus, errorThrown) {
          alert('An error occurred! ' + errorThrown);
        },
        success: function(data, textStatus) {
          $('body').append( data );
        }
      };
      $.ajax( options );

I get a popup that says:

The page at http://localhost:3000 says:An error occurred! Invalid JSON:

Diet | IMRS
  • Sign up
  • Sign in
//and it goes on to render the entire markup of page

Even when I remove the datatype here:
dataType: ‘json’

It still gives same error report.

Any idea as to whether this is devise related?

Thanks for response.

Has anyone gotten devise to work at all with any kind of ajax?