ajax 跨域访问

默认是禁止的,需要在服务器端开启。

 

python tornado示例

class XXXHandler(RequestHandler):

	def post(self, *args, **kwargs):
		self.set_header("Access-Control-Allow-Origin", "*")
		self.set_header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
		...

 

参考:

http://stackoverflow.com/questions/5750696/how-to-get-a-cross-origin-resource-sharing-cors-post-request-working

posted @ 2015-12-03 15:07  tommy.yu  阅读(188)  评论(0编辑  收藏  举报