2

cross domain not working have error in console like this No 'Access-Control-Allow-Origin' header is present on the requested resource

im using html page in asp.net with json

my json code is

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);
}
};

when i execute my page this code i have error

XMLHttpRequest cannot load http://jsil.org/try/compile.aspx. No 'Access-Control-Allow-Origin' header is present on the requested resource

enter image description here

dhruvin
  • 787
  • 1
  • 6
  • 11
Irshad
  • 141
  • 2
  • 12
  • 1
    possible duplicate of [XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin](http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin) – Mousey Aug 17 '15 at 22:35

0 Answers0