我正在运行Ubuntu 15.04,当我尝试从Intel XDK -> Explore Services面板调用任何web服务时,响应类似于:
undefined is not a function
TypeError: undefined is not a function at intel.xdk.services.iodocs_.exports.bindCommon (http://127.0.0.1:58889/http-services/api-explorer/iodocs/api-request-common.js:60:14)
at http://127.0.0.1:58889/http-services/api-explorer/iodocs/tryit?functionName=tryIt1433289861198&apiName=db_core&isDebug=true&code=intel.xdk.services.tryIt1433289861198+%3D+intel.xdk.services.iodocs_.bindCommon.bind%28null%2C+%22intel.xdk.services.tryIt1433289
我一直想弄清楚发生了什么事,但我没有线索!
此错误可能是由于您没有指定一个函数来构建您通过Intel XDK进行的调用的URL。
当你尝试使用web服务时,考虑到intel XDK创建的默认结构,你应该在你的js文件中有如下内容:
(function (credentials, helpers) {
var exports = {};
exports.YourMethodName = function(params) {
var url = 'YourURLWithoutParameters'
if (params) url = url + '?' + $.param(params);
return $.ajax({url: url, type: 'GET'});
};
return exports;
})