Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript JSONP请求返回结果,但也触发错误回调_Javascript_Google Closure Library - Fatal编程技术网

Javascript JSONP请求返回结果,但也触发错误回调

Javascript JSONP请求返回结果,但也触发错误回调,javascript,google-closure-library,Javascript,Google Closure Library,我正在使用Google Closure库开发一个大型web应用程序。基本上,我发送一个跨域请求以从服务器获取一些JSON数据。数据返回正确,一切正常,但为JSONP.send方法指定为error_回调的函数仍会启动,我无法理解原因 这是激发JSONP请求的代码 JSONPhandler.send({ action: 'getAllPublishers', start: 0, length: 15}, goog.bind(function(callback) {

我正在使用Google Closure库开发一个大型web应用程序。基本上,我发送一个跨域请求以从服务器获取一些JSON数据。数据返回正确,一切正常,但为JSONP.send方法指定为error_回调的函数仍会启动,我无法理解原因

这是激发JSONP请求的代码

JSONPhandler.send({
    action: 'getAllPublishers', start: 0, length: 15},
    goog.bind(function(callback) {
        progressBar.setValue(100);
        goog.style.showElement(progressBarContainer, false);
        goog.dom.append(this.mainViewPublications,
                initItems.call(this, callback));
}, this), errorHandler.displayError('UNKNOWN'));

如果JSONP请求的服务器响应类型不是application/json,则永远不会触发错误回调:)