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 8431749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:56:22+00:00 2026-06-10T05:56:22+00:00

What does a Backbone.js ‘Model’ expect back from the server after a call to

  • 0

What does a Backbone.js ‘Model’ expect back from the server after a call to Save()?

The reason I ask is because I had an issue with the model getting cleared after a call to Save(). I fiddled around with the model’s parse() method. I found the returning an empty object or null did not produce this behavior. However, the server was returning some JSON as a “success” message and this information seemed to be overwriting the model:

{
    message: 'SUCCESS'
}

What is the “correct” way for the server to respond to a Save() request from a Backbone model?

Thanks!

  • 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-06-10T05:56:23+00:00Added an answer on June 10, 2026 at 5:56 am

    The server should responde with an HTTP status of 200, most likely, and should return any data that the server generates or updates for the model. Typically, this is only the model’s server generated id field. Any fields that are returned from the server will be applied to the model. So if you send this to the server:

    
    {
      foo: "bar"
    }
    

    and the server response with this:

    
    {
      id: 1, // or some other server generated ID, from a database, etc.
      message: "SUCCESS"
    }
    

    Your model will end up looking like this:

    
    {
      id: 1,
      foo: "bar",
      message: "SUCCESS"
    }
    

    If your model does not need any data updated from the server when the save method is called, then you should return an empty {} object literal.

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

Sidebar

Related Questions

after I change to Backbone-Relational my model stopped to work when I call destroy()..
Does anyone know which event is fired after a view is rendered in backbone.js?
What advantages does forge.ajax has over plain old jQuery.ajax or backbone.save() calls? I understand
Does in Backbone.Router exists the events both before and after performing routing? My app
In my Backbone View, I have two methods, one does a simple AJAX call,
If I call model.destroy , and my model has nested backbone models and/or plain
In Backbone.js, how does a view know what model it represents? Is it necessary
Using backbone, I'd like to fetch data from a couchdb server that is in
Can anyone please explain me what delegateEvents in backbone.js does? The documentation did not
Backbone.js provides a navigate(fragment, [options]) method for its Backbone.router objects, which does the following

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.