Showing posts with label BackboneJS. Show all posts
Showing posts with label BackboneJS. Show all posts

Thursday, September 10, 2015

Great JS frameworks infographic

Here is a great infographic that is very useful when choosing an adequate JS framework for your projects: http://www.webdesigndegreecenter.org/choosing-javascript-framework/

Monday, September 9, 2013

backboneJs: "change:[attribute]" event is not firing

add default values  to the model :

var testModel = Backbone.Model.extend({
defaults: {
    "attribute":  ""
  }
});

Wednesday, August 28, 2013

Backbone: Request Method:OPTIONS Status Code:405 Method Not Allowed trying to do a POST request with collection.fetch

I had this code:

this.organizationServicesCollection.url = 'http://localhost/SkyDesk.Services/SrvService.svc/rest/service/queryservices/'        
var fetchParameters = {
data: JSON.stringify({
    parameters: {'key':'value'}
}),
        type: 'POST',
        contentType: 'application/json'
};
this.organizationServicesCollection.fetch(fetchParameters);

when executed I was having two resulting requests:

Request URL:http://localhost/SkyDesk.Services/SrvService.svc/rest/service/queryservices/
Request Method:OPTIONS

Request URL:http://localhost/SkyDesk.Services/SrvService.svc/rest/service/queryservices/
Request Method:POST

The problem was that my current proyect was being run in http://localhost:49998/ instead http://localhost/ so there was a cross domain issue. I fixed it running my project in http://localhost/ , now when running the code I had my single POST request:

Request URL:http://localhost/SkyDesk.Services/SrvService.svc/rest/service/queryservices/
Request Method:POST

Tuesday, July 23, 2013

BackboneJS: click event is being triggered twice

In the view definition I had:

...
...
 // events
    ,events: {
        'click ': 'selectServiceEvent',
        'click a': 'learnMoreLinkEvent'
    }
...
...
,selectServiceEvent: function () {
        this.clickCard(); 
}

But when I was clicking the div generated by de view, the selectServiceEvent function was being triggered twice. The solution was add return false; to the selectServiceEvent function:

,selectServiceEvent: function () {
        this.clickCard(); 
        return false;
}