English 中文(简体)
fetch (on Backbone.Collection)
原标题:success / error callback(s) not being invoked after fetch (on Backbone.Collection)

I m目前与(或周围)背部有奇怪的问题。 我有一个回头收集物体,对这个物体,我对海关的成败和错误 call击。

A. 工作


    Fubars = Backbone.Collection.extend({ 
      
      url: "/listfubar",
      model: Fubar,
      fetchS: function() {
        fetch(  { success : sFn, 
                    error : eFn, 
                    statusCode : cFn 
        }); 
      },  
    })
    
    var fbars = new Fubars(); 
    fbars.fetchS();

B.-->


    afterPoll = function() {   
        fbars.fetchS()
    }

该作品在<条码>上课以罚金。 然而,在<代码>fetchS(并提供反馈)本身从ajaxPolletback B>上援引的Im。 sync > JQuery.ajax。 但是,从来就没有援引成功、错误或地位要求(就网络而言,网络的号召是明确的,回报是成功的)。

是否有人这样做? 我只能认为,成功和错误的 call击可能正在消失,而当后退出。 但fubars是一个全球目标,因此没有意义。

I ve looked at similar posts (here), but not solving my problem. Any insights are greatly appreciated.

问题回答

do this for fetch..

    
    (function fetch(){success:...,error:... }).call();
    or
    (function fetch(){return {success:...,error:...}
     }).call();
    
    

I suspect, problem may be due to the missing this.

取代本声明:

    fetch(  { success : sFn, 
                error : eFn, 
                statusCode : cFn 
    }); 

with this statement:

    this.fetch(  { success : sFn, 
                error : eFn, 
                statusCode : cFn 
    });




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签