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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:23:14+00:00 2026-06-02T06:23:14+00:00

I have a model,having url property. When i save the model using Save method,

  • 0

I have a model,having url property.
When i save the model using “Save” method, it is sending request to the server.
If the communication is success, the success() method is triggering and if communictaion is failed, “error” function is being triggered.
But, what if there is no communication problem but when the server sends a “failed message” due to some server validations or for other reasons ?
As , due to server side validations(or others),the model not saved in server.
So, it shouldnot be saved in backbone model also.
What should i do to tell the model not to save when the server sends “Error updating database” and tell it to save when i receive “Successfully updated”
I am sending the below response from server :

    $this->response(
        array(
             'model'=>$model,
             'status'=>$status,
             'metamodel'=>array(),
             'message'=>$msg  (either success or fail)(my custom message)
            )
          ); 

in the client side,i am saving like this.

        model.save(attr{
          success:(model,res)->
            // to do when communication success
          error:(model,res)->
            //to do when communication fails
         })

So, how can i check based on the message or the status whether server succeeded or not ?
And,how can i tel model not to save or revert the changes when server says “no”(NOT INTERNAL SERVER ERROR, my custom error bcoz of validations or other reasons)

Also, how can i use Backbone.Sync method ( practical example related to my code,please)
and what does it do? (plz mention clearly whether comunication problem or custom error mesage or internal server error)

I can access “status” and “message” in the “success” method , but how can i use them to revert changes to 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-02T06:23:16+00:00Added an answer on June 2, 2026 at 6:23 am

    Overwrite the parse(response) method on the model and check for an error flag.
    http://documentcloud.github.com/backbone/#Model-parse

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

Sidebar

Related Questions

I have a model Image and every image is having description. User can add
In Django, I have a model, and I will have a dictionary having the
I am having difficulties implementing the codeigniter pagination class. I have created my model,
I am having a problen with using an object with a url_for method, I
I have an Action Method that returns a JSON-serialized object. The problem I'm having
I'm having a FieldError . I have a model: class Foo(models.Model): __bar = models.TextField(default=lambda:
I'm having nice first days using Yii but have some troubles with getting things
How do I set a models reference property correctly? I have a Model called
I'm having trouble with my project. I have 2 models class UserPrefs(db.Model): user =
Having a very frustrating time solving this issue. I have a model which automatically

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.