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

Re : ajax call to database example

$
0
0
If my model looks like the standard model recipe.js below and I modify findAll to look like the findAll to look like the findAll below (from http://javascriptmvc.com/docs.html#!jQuery.Model.static.findAll)... is it going to work without any definitions for name or description in the recipe.js model?

=====================================================
recipe.js
=====================================================
steal('jquery/model', function(){

/**
 * @class Cookbook.Models.Recipe
 * @parent index
 * @inherits jQuery.Model
 * Wraps backend recipe services. 
 */
$.Model('Cookbook.Models.Recipe',
/* @Static */
{
    findAll: "/recipes.json",
      findOne : "/recipes/{id}.json",
      create : "/recipes.json",
     update : "/recipes/{id}.json",
      destroy : "/recipes/{id}.json"
},
/* @Prototype */
{});

})

=====================================================
findAll
=====================================================
findAll : function(params, success, error){
    return $.ajax({
      url: '/recipes.json',
      type: 'get',
      dataType: 'json recipe.models',
      data: params,
      success: success,
      error: error})
  }




Viewing all articles
Browse latest Browse all 3491

Trending Articles