黑白梦黑白梦

  • 文章
  • 专栏
  • 文章
  • 专栏

©2015-2026 黑白梦 粤ICP备15018165号

联系: heibaimeng@foxmail.com

全部文章

fetch-jsonp 跨域 jsonp 请求

发布于 2020-04-09更新于 2023-04-08约 1 分钟

类似 window.fetch 的 JSONP 请求库

https://github.com/camsong/fetch-jsonp

npm install fetch-jsonp

根据接口返回callback函数名,指定即可使用

fetchJsonp('/users.jsonp', {
    jsonpCallback: 'custom_callback',
  })
  .then(function(response) {
    return response.json()
  }).then(function(json) {
    console.log('parsed json', json)
  }).catch(function(ex) {
    console.log('parsing failed', ex)
  })

本文收录于专栏

一些好用的 npm 前端开源库

收集一些好用的前端开源库,主要是 npm 包

0 篇文章更新于 2026-08-17
上一篇tesseract.js 文字 OCR 识别库下一篇fonts.css 跨平台 CSS 中文字体解决方案