Tag: backbone.js

Ajax Post Request Returns JSON but Deferred Fails

I have a cross-domain POST request to http://api.local/user/auth – my API endpoint. I allow Cross Domain requests in my api with CORS. Using Chrome if that makes a difference. I get a valid server JSON response with 200 Status Code but I am using deferreds from a backbone model like so: @model.save() .fail(-> console.log ‘sync […]

How can I log an end user into my single page application, and redirect them to the Single page application?

How can I log an end user into my single page application, and redirect them to the Single page application, using Backbone.js. Express.js and passport.js. I have passport, mongo.db, express, and backbone all working on my application. However, upon successful login, I want to load up the single page, backbone js, web application. As of […]

Creating an HTML element with jQuery doesn't always work

I’m building a live theme picker for a project of us and it works. That’s great! But I’ve got one bug left, which I can’t solve and it drives me crazy. This is the problem: On the moment you’ll load the theme picker page, the backbone app (it’s build with Backbone JS, Underscore JS and […]

Backbone.js intercept AJAX requests

I have an application using Backbone.js that has various AJAX requests. I want to be able to intercept all AJAX requests and do some pre and post request functions without having to specify these functions at the point of definition. An example of what I want to do is if the response from the request […]

Dynamically generate site navigation from JSON with Backbone.Marionette

I’m trying to build my navigation based upon the contents of a JSON object returned by a REST API. I’ve been looking at trying to adapt David Sulc’s tutorial, but am running into a bit of a blocker somewhere. My app uses the following basic structure: window.Foo = { Routers: {}, Models: {}, Collections: {}, […]

Debugging JS/CoffeeScript code: Events, Callbacks etc

Recently I am finding difficulty understanding whats happening in a CoffeeScript/Backbone app. Its hard to trace whats happening quickly without a very slow step through. The problem I think is: I know an event is triggered (Backbone view event). But I dont know which functions are called because of it. There maybe more than 1. […]

Using Backbone collections in the right way to pass them in the sub view and then in the template engine

I’m trying understand how to work with Backbone collections and to pull them inside the relative template engine created by a sub view. This is the logic i tried in my app: My ajax request returns me this object: { “products”:[ { “id”:”43″, “text”:”Sunset Chips”, “image”:”43.png” },{ “id”:”107″, “text”:”Pringles Hot & Spicy”, “image”:”107.png” } ], […]

Backbone.js and non-model objects

I am currently using Backbone.js as a front-end MVC system. Assume, however, that I have objects which are not necessarily models (for example, an object which parses JSON from a successful AJAX request). How should I best represent these objects? I don’t think they’re “models” in the traditional sense. Should they just be normal JavaScript […]

Android native browser 2.3.7: Youtube iframe API “onReady” event not fired

I am testing my backbone app on Win/mac chrome & firefox, iPad, iPhone, Android 4.3, Android 4.1.2, and Android 2.3.7. The Youtube iFrame API is working as expected on all platforms except Android 2.3.7 using the native browser. I’ve tracked it down to the object returned by YT.Player() never firing its onReady event, or any […]

What is wrong with the handlebar code?

Hey so I am trying to switch from underscore to handlebar, but nothing is rendering from the model, but the templates are changing correctly. Also, when the editTemplate shows from clicking the edit button the #{firstName} and others show as undefined. In my layout jade file I do include all the appropriate files, jquery, underscore,backbone […]