A
A
arhangel1232015-12-18 18:40:59
JavaScript
arhangel123, 2015-12-18 18:40:59

POST request to send data to the server?

how to make a POST request to javascipt that takes data (in this case, the c# language code), sends it to the site, where this code is compiled and returns the result?
there is code that does the same but for c++ language:

var cmd = "g++ -Wall main.cpp -o main_prog && echo 'Compilation: SUCCESS."
+ " Program output is:\n' && ./main_prog && echo "\nExit code: $?"";

var output = $("#output");
output.text('');
var to_compile = {
"src": code.getValue(),
"cmd": cmd,
};

output.text("Executing... Please wait.");

$.ajax({
url: "coliru.stacked-crooked.com/compile",
type: "POST",
dataType: "text"
}).done(function(data) {
output.text(data);
}).fail(function(data) {
output.text("Server error: " + data);
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question