Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6723869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:37:14+00:00 2026-05-26T09:37:14+00:00

With backbone.js I’m saving a model. A PUT is send to the server and

  • 0

With backbone.js I’m saving a model. A PUT is send to the server and the response is returned. The first time I do it, it returns success, the following times an error is return, because after the first time the response is added to the model.

Save function in Backbone.js:

saveCountry: function() {
    this.model.save({},{
        success: function(model, response) {
            console.log('success! ' + response);
        },
        error: function(model, response) {
            console.log('error! ' + response);
        }
    });
    this.render();

    return false;
},

PHP returns a JSON-string:

{"response": "Model saved!"}

Following PUT’s get an error as response, because ‘response’ is added to the model:

Unknown column 'response' in 'field list'

Why is the response added to the model and how do I prevent it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:37:15+00:00Added an answer on May 26, 2026 at 9:37 am

    From Backbone’s documentation on model save:

    Set a hash of model attributes, and sync the model to the server. If
    the server returns an attributes hash that differs, the model’s state
    will be set again.
    http://documentcloud.github.com/backbone/docs/backbone.html#section-41

    What to do to make it work: don’t return {“response”: “Model saved!”} from the server. Just return a success (status 200) with no content.

    If the save did not work, return a JSON with the errors, and Backbone will trigger an error event on your model, with the JSON you provided (see http://documentcloud.github.com/backbone/docs/backbone.html#section-41 and http://documentcloud.github.com/backbone/docs/backbone.html#section-145).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assume a Backbone model with the following attributes: - subtotal - discount - total
My backbone collection fetches its models without issue. The model returns {{=calldate}} in the
Currently I'm working on a Server-Client system which will be the backbone of my
Backbone.js makes a POST request when a new model is created and saved, but
Newbie backbone question: Context: Building a shopping list with backbone I have a model
I started my first backbone.js app today and I meet a first problem. I
I've got a backbone model with contains a collection. The output from the console
I've got a Backbone.Collection full of models; let's say that model is Car .
I really like Backbone, but I am having the hardest time doing what would
I have the following backbone.js client side template: <script id=calleeTemplate type=text/x-jquery-tmpl> <tr style=background-color: ${StatusColour}>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.