如何在angular 8中处理JSONP请求

时间:2019-07-23 06:57:27

标签: jsonp angular8

issue:未定义回调函数:angular 8

processData([{"Type":"ADULT","ADTDTL":[{\"Name"\:\"ADULT1"\,\"Age"\:\"30"\},{\"Name"\:\"ADULT2"\,\"Age"\:\"35"\}]"},{"TYPE": "CHILD","CHDDTL": [{\"Name"\:\"CHILD1"\,\"Age"\:\"10"\},{\"Name"\:\"CHILD2"\,\"Age"\:\"12"\}]"}])
  

未捕获的ReferenceError:未定义processData

实际JSONP结果

var auth = "116asd1f2341dfas2f"
//this is executed always before somone calls a request
app.use(function (req, res, next) {
var header=req.headers['authorization'];      // get the header
if(header != auth)
{
  res.status(401)        // HTTP status 404: NotFound
    .send('401 Unauthorized');
  return
}
next();
});

0 个答案:

没有答案