Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Passing additional parameters into save()

$
0
0
Hi Curtis,

Below is the Model I have and the URl I am trying to hit has /site/{site_ID}/location/{location_ID}

can.Model('Bio.Model.SiteLocation',
/* @Static */
{
    models : function(instanceRawData){
       
        var formattedRaw = {
            data : instanceRawData.items
        };

        return this._super(formattedRaw);
    },
    attributes : {
        name : 'string',
        location: 'string',
        id: 'int'
    },
    findAll : function(params, success, error){
        return $.ajax({
            url:'/bio/rest/site/'+params.siteId+'/locations' ,
            dataType: "json",
            traditional: true,
            type:'GET',
            cache : false
        });
    },
    destroy : function(params, success, error){
        return $.ajax({
            url: '/bio/rest/site/'+params.siteId+'/locations/'+params.locationId,
            traditional: true,
            type:'DELETE'
           
        });
    },
   
    create: function(params, success, error){
        return $.ajax({
            url:'/bio/rest/site/'+params.siteId+'/locations',
            dataType:"json",
            traditional:true,
            type:'POST',
            data : params
        });
    }
}, {
   
});

Viewing all articles
Browse latest Browse all 3491