Angular jsonp 例子

  • A+
所属分类:前端
window.getPhoneNumberInfoCallback = (args) => {
  //console.log(this, arguments, args)
  if(args.message === 'success'){
    args.data.isp && args.data.isp.indexOf('中国') !== 0 && (args.data.isp = '中国' + args.data.isp)
    this.province        = args.data.province
    this.city            = args.data.city
    this.isp             = args.data.isp
    this.phoneNumberInfo = `${args.data.province||''} ${args.data.city||''} ${args.data.isp||''}`
  }
  args.message === 'success' || (this.phoneNumberInfo = '未知地区或医院内部号码')
}
this.getPhoneNumberInfo = cb => {
  //console.log('getPhoneNumberInfo', arguments)
  //this.number.length < 7 && (this.phoneNumberInfo = '')
  //this.phoneNumberInfo || this.number.length > 6 &&
  this.number && $http({
    url   : `http://${window.location.hostname + ':13800'}/?callback=getPhoneNumberInfoCallback&mobile=` + this.number,
    method: 'jsonp'
  }).success(function (data, header, config, status) {})
    .error(  function (data, header, config, status) {})
}
楚廉

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: