js script标签发送跨域请求,没进入回调是什么原因?

<script
type="text/javascript"
defer="defer"
src="http://localhost:8080/cqpt/ueditor/exec?action=config&callback=bd__editor__e3zw61"

</script>
使用script 标签发送 这样的一个请求
http://localhost:8080/cqpt/ueditor/exec?action=config&callback=bd__editor__e3zw61
Window对象上也挂载了着个方法

clipboard.png

后台请求接受成功,并返回json格式的数据,

但是前台始终接受不到 返回的信息,这是什么情况?

使用的ueditor dojsonp的方法

返回的数据格式
{

"videoMaxSize":102400000,
"videoActionName":"uploadvideo",
"fileActionName":"uploadfile",
"fileManagerListPath":"/ueditor/jsp/upload/file/",
"imageCompressBorder":1600,
"imageManagerAllowFiles":[],
"imageManagerListPath":"/ueditor/jsp/upload/image/",
"fileMaxSize":51200000,
"fileManagerAllowFiles":[],
"fileManagerActionName":"listfile",
"snapscreenInsertAlign":"none",
"scrawlActionName":"uploadscrawl",
"videoFieldName":"upfile",
"imageCompressEnable":true,
"videoUrlPrefix":"",
"fileManagerUrlPrefix":"",
"catcherAllowFiles":[],
"imageManagerActionName":"listimage",
"snapscreenPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"scrawlPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"scrawlMaxSize":2048000,
"imageInsertAlign":"none",
"catcherPathFormat":"/ueditor/jsp/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}",
"catcherMaxSize":2048000,
"snapscreenUrlPrefix":"",
"imagePathFormat":"/uploadfile/{yyyy}{mm}{dd}/{time}{rand:6}",
"imageManagerUrlPrefix":"",
"scrawlUrlPrefix":"",
"scrawlFieldName":"upfile",
"imageMaxSize":2048000,
"imageAllowFiles":[],
"snapscreenActionName":"uploadimage",
"catcherActionName":"catchimage",
"fileFieldName":"upfile",
"fileUrlPrefix":"",
"imageManagerInsertAlign":"none",
"catcherLocalDomain":[],
"filePathFormat":"/ueditor/jsp/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}",
"videoPathFormat":"/ueditor/jsp/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}",
"fileManagerListSize":20,
"imageActionName":"collect/uploadFile",
"imageFieldName":"upfile",
"imageUrlPrefix":"http://127.0.0.1:8080/cqpt",
"scrawlInsertAlign":"none",
"fileAllowFiles":[],
"catcherUrlPrefix":"",
"imageManagerListSize":20,
"catcherFieldName":"source",
"videoAllowFiles":[]

}

阅读 2.7k
3 个回答

后端给你拼的字符串是啥,可以发出来吗,结构发出来就行
让后端拼这样一个字符串给前端

bd__editor__e3zw61(
  //你现在返回的对象 {巴啦巴拉一堆数据}
)

你的请求中是带了bd__editor__e3zw61这个名字的,让后端给你拼下就行了

是不是返回的东西有问题,就是返回的脚本里面只是声明了bd__editor__e3zw61这个函数但是并没有执行

信息不足。

  1. 在可疑位置逐行console.log
  2. 查看开发者工具的网络标签,检查该请求的内容。
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏