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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:07:57+00:00 2026-05-28T15:07:57+00:00

Backbone.js makes a POST request when a new model is created and saved, but

  • 0

Backbone.js makes a POST request when a new model is created and saved, but it doesn’t consider the model to be saved (i.e, further saves result in PUTs not POSTs) until the model has an id.. how should the server return the ID of a newly created model so that backbone.js can set it (i.e, how should it respond to the initial POST)?

If backbone.js doesn’t handle that, I assume the best way to do it is using the success handler to set the ID?

  • 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-28T15:07:58+00:00Added an answer on May 28, 2026 at 3:07 pm

    You have two options. The first is to return the same JSON structure for a POST request as you would a GET request for the show action (returning a single item.) This uses a single request.

    From the documentation:

    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.

    The other option is to trigger a fetch on your collection after you save. This will take more than 1 request though and will always be less efficient.

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

Sidebar

Related Questions

I'm trying to make a quick sample Backbone.js app that has a Post model,
I am having trouble with some really basic Backbone.js functionality. window.Album = new Backbone.Model.extend({});
I have encountered a strange behaviour of the model validation in Backbone.js. When a
I’m just starting out with Backbone.js. I’ve subclassed Backbone.Model and Backbone.View : var Message
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
Backbone JS highly recommends you use jQuery. However, it doesn't do things very jQuery.
Is it possible to use Backbone.js and jquery.datalink.js together to link a Backbone model
Frustratingly, most ‘tutorial’ examples of backbone.js apps assume a clean model slate. I-.e. that
I'm using backbone.js For example, let's suppose we have a products model and a

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.