“No 'Access-Control-Allow-Origin' header is present on the requested resource” in django
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am newbie to django and using it as back end for an application that creates users. In front end the code for posting the user name is : var xobj = new XMLHttpRequest (); xobj . overrideMimeType ( "application/json" ); xobj . open ( 'POST' , "http://www.local:8000/create_user/" , true ); xobj . setRequestHeader ( "Access-Control-Allow-Origin" , "*" ); xobj . onreadystatechange = function () { if ( xobj . readyState == 4 && xobj . status == "200" ) { console . log ( xobj . responseText ); } } xobj . send ( json ); On back end the