How do you find an error caused by sampling the baseline

I am new to the highway, but I wrote a basic model and while trying to get data for my model. I know the server is returning data, but fetch is throwing an error callback.

This is fine, but I don’t know how I can find which error is generated.

Here is the relevant code:

  mUser = Backbone.Model.extend({
    urlRoot: CURRENT_URL+'user',
    defaults: {
        name: '',
        age: 22,
        email: ''
    },
    initialize: function(){

    }
  });

  user = new mUser({'id':1});

  var x = user.fetch({
    error:   function(model, xhr, options){
       alert('Error on fetch')
       console.log(xhr.responseText);
    },
    success: function(model, response, options) {
        alert(user.toJSON());
    }
  })
  console.log('x email',x.email)

As I mentioned, responseText has data that I expect to see from the server:

{'ID': '1', 'Name': 'Joe', 'age': '25', 'email': ' joe@example.com '}

Perhaps I should mention that I am doing this as part of the Android PhoneGap Android application. I don’t think it’s important for the problem I am having, but it limits my debugging options.

+5
1

, parsererror, jQuery JSON . , parsererror, complete textStatus. .

user.fetch({
  complete: function(xhr, textStatus) {
    console.log(textStatus);
  }
});
+13

All Articles