Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
Bloqueo de lectura de origen cruzado (CORB) en backbone.js

Cuando llamo a la función sites.fetch() en la consola de Google, aparece este error Cross-Origin Read Blocking (CORB) blocked cross-origin response https://api.nutritionix.com/v1_1/search?callback=jQuery351004426279547866718_1648579753369&\_=1648579753370 with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details. Lo leí y parece que necesito agregar algunos encabezados, pero no sé cómo agregar backbone.js.

Aquí mi código:

 App = {}; App.Site = Backbone.Model.extend(); App.Sites = Backbone.Collection.extend({ url: "https://api.nutritionix.com/v1_1/search", model: App.Site, fetch: function(options){ options = options || {}; options.dataType = 'jsonp'; Backbone.Collection.prototype.fetch.call(this, options); } }); App.LoadSites = Backbone.View.extend({ initialize: function(){ this.listenTo(this.collection, 'add', this.renderOne); this.listenTo(this.collection, 'reset', this.renderAll); this.listenTo(this.collection, 'sync', this.renderAll); }, tagName: 'ul', className: 'Sites', render: function(){ this.collection.trigger('reset'); return this; }, renderAll: function(){ this.$el.empty(); this.collection.forEach(this.renderOne); }, renderOne: function(site){ loadSite = new LoadSite(); loadSite.model = site; loadSite.render().$el.appendTo(loadSites.el); } }); App.LoadSite = Backbone.View.extend({ template: _.template('<p><strong><%= text %></strong></p>'), tagName: 'li', className: 'Site', render: function(){ var innerHTML = this.template({text: this.model.get('text')}); this.$el.html(innerHTML); return this; } }); var loadSite, sites; $(function() { sites = new App.Sites([]); loadSites = new App.LoadSites({ collection: sites }); loadSites.render().$el.appendTo('#back'); console.log('veiw rend') })

Probé otras cosas pero no pude solucionarlo.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!