我正在尝试使用此发布到弹簧端点-
_checkForInfiniteScrolling:=>
query = @options.query
scrollElement = @searchResultContainerElem[0]
prog = (scrollElement.scrollTop + scrollElement.offsetHeight)/scrollElement.scrollHeight
if (prog > 0.8) and !@endData and scrollElement.scrollTop > 0
console.log("hitting ajax")
@getMoreResults(query)
getMoreResults:(query)=>
longitude = query.get("longitude")
latitude = query.get("latitude")
if (longitude!="" && latitude !="")
@findMoreLocationPlates(query)
else
@findMorePartialPlates(query)
findMorePartialPlates:(query)=>
console.log("in find more partial plates")
$.ajax({
type: 'POST',
data: query,
url: "someUrl"
success: @_appendNewResults
})
但是,它正在调用另一个模型中存在的此函数-
loadSearchHistory:=>
console.log("load search being called")
$.ajax({
type: 'GET',
url: "anotherUrl",
success:@_searchHistoryLoaded
});
_searchHistoryLoaded:(data)=>
console.log("wtf?")
searchHistoryView = new SearchHistory(pastSearches:data)
奇怪的是,_searchHistoryLoaded 被调用,然后 loadSearchHistory 被调用,这永远不会发生,因为 _searchHistoryLoaded 永远不会从另一个函数调用。
为了提供帮助,这是错误的堆栈 -
PlateSearchQuery._searchHistoryLoaded (-search.js:78)
(anonymous function) (-search-results.js:4)
jQuery.extend.param.add (jquery-1.7.1.js:7601)
buildParams (jquery-1.7.1.js:7658)
jQuery.extend.param (jquery-1.7.1.js:7621)
jQuery.extend.ajax (jquery-1.7.1.js:7467)
handleAjax (jquery.mockjax.js:469)
PlateResultsView.findMorePartialPlates (-search-results.js:227)
(anonymous function) (-search-results.js:4)
PlateResultsView.getMoreResults (-search-results.js:221)
(anonymous function) (-search-results.js:4)
PlateResultsView._checkForInfiniteScrolling (-search-results.js:210)
(anonymous function) (-search-results.js:4)
jQuery.event.dispatch (jquery-1.7.1.js:3256)
$event.dispatch (jquery.event.drag-2.2.js:374)
jQuery.event.add.elemData.handle.eventHandle (jquery-1.7.1.js:2875)
诚然,任何人都可能很难解决这个问题,关于如何调试它的建议也将不胜感激。
编辑-
跟踪错误 - 我现在已经建立了当我在 console.log("wtf?)