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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:21:45+00:00 2026-06-08T03:21:45+00:00

When a save , or create is tossed towards the server, the server responds

  • 0

When a save, or create is tossed towards the server, the server responds with a new randomly created object. The object can be one of many different Classes, and Backbone responds to these differentiating objects and loads a relative view.

I can only seem to figure this logic out on bootstrap, as no view has been loaded yet, so I can based on what information I am randomly receiving from the server, bootstrap and navigate to that specific route.

However, I am stuck on trying to figure out how to do this when I save an object, and receive my return data.

Here’s my code broken down.

The information is saved.

@model.save(@model.toJSON(),

I have a listenener waiting for this save :

constructor: (options) ->
  super(options)
  @model.bind 'change:verb', _.chooser, options

_.maestra_chooser is a mixin I have in a utility belt :

_.mixin
  _chooser : (item) =>
    console.log item

Something to note here. The variable item is unfortunately, the same @model that was just saved. No new data there.

What I’m hoping for item to be is the new variable data from the server, so that I can take that data, see what kind of data it is, and then route to the relevant view.

This is where I believe I’m also making an architecturally unsound idea. But for reasons I don’t understand enough to explain.

Does anyone know where I can access the return data from the server and appropriately navigate my app to that respective route?

Additional Information

This is how I bootstrap it appropriately :

window.router = new Project.Routers.QuestionsRouter(
{
  words: #{ @words.to_json.html_safe }  
});

Backbone.history.start();

router.navigate("#{@words.kind_of?(Array) ? "bar" : "foo"}", {trigger: true, replace: true})    
  • 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-08T03:21:47+00:00Added an answer on June 8, 2026 at 3:21 am

    The change event is only ever going to give you the model and the value that changed…

    You can pass a success callback to your save:

    @model.save(@model.toJSON(), success: (model, resp) ->
        # do whatever with resp
    )
    

    where resp will contain the raw response from the server and model will contain the server side state of your model.

    You can also bind to your model’s sync event as mentioned in the comments:

    @model.bind 'sync', _.masetra_chooser, options
    

    the sync callback is called with arguments: model, resp and options where options is the set of options passed to save.
    https://github.com/documentcloud/backbone/blob/9a12b7640f07839134e979b66df658b70e6e4fe9/backbone.js#L383

    Not really sure why you are expecting to get data back from a save that’ll change your page though. Seems a bit odd.

    What type of data are you expecting to receive after a save that wouldn’t be in your model?

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

Sidebar

Related Questions

Any idea on how to create and save a new User object with devise
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
I'm working on a website where users can create and save their own HTML
Let's say I create a new Entity and Save it as follows: UserReport report
Can i create save password protected Excel file with php? I find the a
I'm having troubles understanding why save and create should be any different using these
In C# ASP.Net, I would like to create and save a text file to
I have a model Foo which :has_many bars , initially I create and save
I'm trying to create a game save system which involves saving a score for
I want to create own filetype to save objects in my app. Basically, I

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.