Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 无法加载XMLHttpRequesthttp://differentserver.org/try/compile.aspx. 否';访问控制允许原点';请求的资源上存在标头_Javascript_Jquery_Json_Cross Domain - Fatal编程技术网

Javascript 无法加载XMLHttpRequesthttp://differentserver.org/try/compile.aspx. 否';访问控制允许原点';请求的资源上存在标头

Javascript 无法加载XMLHttpRequesthttp://differentserver.org/try/compile.aspx. 否';访问控制允许原点';请求的资源上存在标头,javascript,jquery,json,cross-domain,Javascript,Jquery,Json,Cross Domain,跨域不工作 在控制台中有这样的错误 请求的资源上不存在“Access Control Allow Origin”标头 我在asp.net中使用带有json的html页面 我的json代码是 function beginCompile() { setControlsEnabled(false); clearOutputWindow(); var sourceCode = window.cseditor.getValue() || document.getElementById("sourcecod

跨域不工作 在控制台中有这样的错误 请求的资源上不存在“Access Control Allow Origin”标头

我在asp.net中使用带有json的html页面

我的json代码是

function beginCompile() {
setControlsEnabled(false);
clearOutputWindow();
var sourceCode = window.cseditor.getValue() || document.getElementById("sourcecode").value;
//alert(sourceCode);
setStatus("Compiling...");   
    $.ajax({
        type: "POST",
        url: "http://jsil.org/try/compile.aspx",
        contentType: "text/plain; charset=UTF-8",
        cache: false,
        dataType: "json",
        data: sourceCode,
        success: compileComplete,
           error: function (xhr, status, moreStatus) {
               compileComplete(false, status + ": " + moreStatus);
           },
    });
};
function compileComplete(data, status) {
setControlsEnabled(true);

if (data && data.ok) {
    setJavascript(data.javascript);
    setStatus(
      "Compile successful.<br>" +
      "C# compile took " + data.compileElapsed + " second(s).<br>" +
      "Translation took " + data.translateElapsed + " second(s)."
    );

    highlightErrorLines(null);
    runInOutputWindow(data.javascript, data.entryPoint, data.warnings);
} else {
    var errorText = String(data.error || status);
    highlightErrorLines(errorText);
}
};
函数beginCompile(){
setControlsEnabled(假);
clearOutputWindow();
var sourceCode=window.cseditor.getValue()| | document.getElementById(“sourceCode”).value;
//警报(源代码);
设置状态(“编译…”);
$.ajax({
类型:“POST”,
url:“http://jsil.org/try/compile.aspx",
contentType:“文本/普通;字符集=UTF-8”,
cache:false,
数据类型:“json”,
数据:源代码,
成功:编译完成,
错误:函数(xhr、状态、状态){
compileComplete(错误,状态+”:“+moreStatus);
},
});
};
函数编译完成(数据、状态){
setControlsEnabled(真);
if(data&&data.ok){
setJavascript(data.javascript);
固定状态(
“编译成功。
”+ “C#compile以“+data.compileeExpressd+”秒为单位进行编译。
”+ 翻译时间为“+data.translateeExpressed+”秒 ); highlightErrorLines(空); runInOutputWindow(data.javascript、data.entryPoint、data.warnings); }否则{ var errorText=字符串(data.error | | status); highlightErrorLines(errorText); } };
当我执行我的页面时,这个代码有错误

XMLHttpRequest无法加载。请求的资源上不存在“Access Control Allow Origin”标头

可能存在的副本