Skip to content

Instantly share code, notes, and snippets.

@codeyu
Created May 22, 2017 16:06
Show Gist options
  • Save codeyu/c86c1ce4746f7273dfaf5157360569c5 to your computer and use it in GitHub Desktop.
Save codeyu/c86c1ce4746f7273dfaf5157360569c5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<body>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
var to_compile = {
"LanguageChoice": "1",
"Program": $("#code").val(),
"Input": "",
"CompilerArgs" : ""
};
$.ajax ({
url: "http://rextester.com/rundotnet/api",
type: "POST",
data: to_compile
}).done(function(data) {
alert(JSON.stringify(data));
}).fail(function(data, err) {
alert("fail " + JSON.stringify(data) + " " + JSON.stringify(err));
});
});
});
</script>
</head>
<textarea id="code">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
Console.WriteLine("Hello, world!");
}
}
}
</textarea>
<button id="run">Run</button>
</body>
</html>
@mensenvau
Copy link

fail {"readyState":0,"responseText":"","status":0,"statusText":"error"} "error" why only the result?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment