Skip to content
Create a gist now

Instantly share code, notes, and snippets.

function DJR() {
this.ajax = function(params, success, url, method) {
success: success,
url: url,
type: method
for(var action in this.routes){
this[action] = function(params, success){
this.ajax(params, success, );
function CursosController(){ DJR.apply(this); }
CursosController.prototype.routes = {
index: {
url: "/cursos", method: "GET"
create: {
url: "/cursos", method: "POST"
destroy: {
url: "/cursos/:id", method: "DELETE"
var cursos = new CursosController
cursos.create({ nome: "Teste" }, function(){});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.