起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1928|回复: 3

[处理中3] 选择.net后台后,能查询,不能保存

[复制链接]

21

主题

39

帖子

239

积分

中级会员

Rank: 3Rank: 3

积分
239
QQ
发表于 2017-5-22 14:04:04 | 显示全部楼层 |阅读模式
程序能够读取数据,但一点击保存就弹出错误信息,跟踪如下:
XMLHttpRequest cannot load http://121.42.176.211:9098/baas/PigManager/Pig_action/saveJxDw. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.send @ core.min.js:71
core.min.js:71 Uncaught Error: __justepClientErrorStart__{"code":"JUSTEP230109","message":"网络出错"}__justepClientErrorEnd__
应该是跨域造成的,怎么处理!!!!
访问:http://localhost:8080/x5/UI2/v_/PigManager/mainActivity.w?device=m
其中的.net地址为:
justep.Baas.BASE_URL = "http://localhost:2080/baas";
发表于 2017-5-22 14:19:16 | 显示全部楼层
难道你不是访问的.net 的baas吗??
既然指定 justep.Baas.BASE_URL = "http://localhost:2080/baas";
为什么baas 访问会是  http://121.42.176.211:9098/baas

IP 地址不一样,当然就跨域了

baas的跨域可以配置一下:
http://docs.wex5.com/wex5-server-question-list-2011/

qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

21

主题

39

帖子

239

积分

中级会员

Rank: 3Rank: 3

积分
239
QQ
 楼主| 发表于 2017-5-22 14:31:19 | 显示全部楼层
liangyongfei 发表于 2017-5-22 14:19
难道你不是访问的.net 的baas吗??
既然指定 justep.Baas.BASE_URL = "http://localhost:2080/b ...

XMLHttpRequest cannot load http://localhost:2080/baas/PigManager/Pig_action/saveJxDw. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.send @ core.min.js:71h.extend.ajax @ core.min.js:71i.sendRequest @ core.min.js:71r.extend.doSaveData @ common.min.js:15justep.ModelComponent.extend.saveData @ common.min.js:15Model.saveBtnClick @ mainActivity.js:10r.extend.fire @ core.min.js:71r.extend.fireEvent @ core.min.js:71n.callParent @ core.min.js:71Component.extend.fireEvent @ common.min.js:15n.BindComponent.extend._doClick @ comp.min.js:144h.isFunction.i @ core.min.js:71h.event.dispatch @ core.min.js:71g.handle @ core.min.js:71
core.min.js:71 Uncaught Error: __justepClientErrorStart__{"code":"JUSTEP230109","message":"网络出错"}__justepClientErrorEnd__
我开始设置 http://121.42.176.211:9098/baas/PigManager/Pig_action/saveJxDw不好用,我又改为本地,也不行
问题没有解决!!!!!!!
跨域问题设置我看了,跟你们设置一样
回复 支持 反对

使用道具 举报

发表于 2017-5-22 14:53:41 | 显示全部楼层
gaochongxin 发表于 2017-5-22 14:31
XMLHttpRequest cannot load http://localhost:2080/baas/PigManager/Pig_action/saveJxDw. No 'Access-C ...

浏览器访问页面的地址 端口是 8080
而BaasServer的地址 端口是2080
端口都不一样 ,肯定会跨域的!所以你需要做的是服务器支持跨域!

上网搜下!在服务器代码中指定 支持跨域,试试吧
response.setHeader(“Access-Control-Allow-Origin”, “*”);

关于跨域的理解,请看下http://docs.wex5.com/ajax-cross-domain/
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-9-23 22:25 , Processed in 0.107668 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表