简体   繁体   中英

jquery ajax, backbone, jsonp callback not defined

sync: function(method, model, options) {
  options.dataType = 'jsonp';
  options.cache = true;
  options.jsonp = 'callback';
  options.jsonpCallback = "inflchallcb";
  return Backbone.sync(method, model, options);
},

results in

api call

https://url.tld?callback=inflchallcb

server response is

inflchallcb({...})

with

Content-Type: text/javascript; charset=utf-8

results in error:

ReferenceError: inflchallcb is not defined at eval (eval at 

jquery v 1.11.1 backbone 1.3.3

I have no clue.

将一些console.logs添加到jquery源之后,我意识到有两个并发请求,每个请求都附加和删除相同的全局函数,我必须使全局函数唯一,但也可以为每个请求缓存。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM