I have following URLs:
/tasks/ // Return a list of JSON
/task/next-week/ // Return a list of JSON
I have Task model in JSMVC:
$.Model('Task', {
findAll: 'GET /tasks/',
findOne: 'GET /task/{id}'
});
How can I support /task/next-week/
?
The following code:
Task.findAll({'range': 'next-week'})
results in the request /tasks/?range=next-week
, but this is wrong for my project.
How could I properly encapsulate the service, so the request will look normally like /task/next-week/
?
You can specify a function for
findAll
and make a custom ajax request, such as what's suggested in the docs: