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

  • Home
  • SEARCH
  • 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 7647831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:33:38+00:00 2026-05-31T10:33:38+00:00

I’m developing backbone app, which makes crossdomain restful request. The nested data structure in

  • 0

I’m developing backbone app, which makes crossdomain restful request. The nested data structure in request are required, in the curl request I have that structure:

{
    "site_id": 1,
    "post": {
        "site_id": 1,
        "provider_id": 1,
        "provider_post_id":1,
        "created_ts": "12.12.12",
        "post": {
            "header": "text",
            "caption": "text",
            "image": "http://...jpg"
        }
    }
}

In the model I have not nested structure and this is pretty comfortable, because I use image model field in the view (DOM element creation).

What the correct way to send nested data to server from Backbone app?

Model:

var WraperModel = Backbone.Model.extend({
    url: 'http://mydomain/core/api/v1/bookmarklet_post/?  callback=?',
    defaults: {
        site_id: 1, // shouldn't be hardcoded
        type:"type", site_id:2, provider_id: 2, provider_post_id: 2,  created_ts:2,
        header : '',
        caption: '',
        image: ''
    },
});

The part of view, which use image model property:

drawItem: function (model) {
    var inst = new ImageView({model: model, tagName: 'li',     className:'images-item'}).render();
    this.imagesWrapper.append(inst.el);
},
getImages: function () {
   var images = doc.getElementsByTagName('img'),
       view = this;
   _.each(images, function (image) {
       image.offsetHeight > 75 
       && image.offsetWidth > 75 &&
       view.collection.add({image: image.src});
   });
},

The part of another view, which send data to server.

sendTo: function(){
    var that = this,
    data = {saving: true};

    $('#add-header').val() && (data.header = $('#add-header').val());
    $('#add-description').val() && (data.caption = $('#add-description').val());
    this.model.set(data);
    this.model.save();
}
  • 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-31T10:33:39+00:00Added an answer on May 31, 2026 at 10:33 am

    the first parameter you pass in save is a hash of the attributes that are going to be passed along in your save.

    In your sendTo function just build up an object with the data from your model and any additional form values in a way that the server expects. By default, when a save is successful the data from the response will be passed through the parse method and set back on the model.

    var myData = {
         //create nested object for the server
    };
    
    this.model.save(myData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.