Setup with Backbone.js

84 views
Skip to first unread message

Michael McLaughlin

unread,
Jun 17, 2014, 2:11:04 PM6/17/14
to serve...@googlegroups.com
hey all, so I'm following along with this tutorial: https://www.youtube.com/watch?v=FZSjvWtUxYk
but I'm running into a bit of an error when I try the same thing in a serve project. I would really like to use serve, but at the same time, it might not be worth, since the views are being generated by the js models anyway...
I have this file located in the root of the serve project, called users (if you watch the video, it's at about 20 mins) and I'm trying to get the content (models) from it to backbone. I keep running into this error though: 

  1. OPTIONS localhost:4000/users net::ERR_UNKNOWN_URL_SCHEME jquery-1.10.2.min.js:6
    1. Backbone.View.extend.render(index):54
    2. (anonymous function)(index):74
    3. Backbone.Events.triggerbackbone-1.1.2.min.js:148
    4. (anonymous function)backbone-1.1.2.min.js:1255
    5. (anonymous function)backbone-1.1.2.min.js:1481
    6. (anonymous function)

  2. just wondering if anyone knows why this might be happening.

it's happening when I try to access the file with the model in it:


$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
options.url = 'localhost:4000' + options.url;
});

var Users = Backbone.Collection.extend({
url: '/users'
});

var UserList = Backbone.View.extend({
el: '.page',
render: function(){
var that = this;
var users = new Users();
users.fetch({
success: function(users){
var template = _.template($('#user-list-template').html(), {users: users.models});
that.$el.html(template);
}
});
}
});

John W. Long

unread,
Jun 17, 2014, 2:14:44 PM6/17/14
to serve...@googlegroups.com
Try:

options.url = ‘http://localhost:4000' + options.url;

—John

--
--
Serve Users Group
Mailing List: http://groups.google.com/group/serve-users/
Project: http://github.com/jlong/serve/

---
You received this message because you are subscribed to the Google Groups "Serve Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to serve-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc
Reply all
Reply to author
Forward
0 new messages