石墨消解 mock
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
682 B

const ws = new WebSocket(`ws://${window.location.host}`);
ws.onopen = () => {
console.log("Connected to server");
ws.send("Hello from client!");
};
ws.onmessage = event => {
console.log(`Message from server: ${event.data}`);
};
ws.onclose = () => {
console.log("Disconnected from server");
};
$("#moveArm").on("click", () => {
const x = $("#armX").val();
const y = $("#armY").val();
const z = $("#armZ").val();
$.ajax({
type: "POST",
url: "/api/debug/railArm",
data: JSON.stringify({ x: +x, y: +y, z: +z }),
contentType: "application/json",
success: res => {
console.log("Success", res);
},
error: err => {
console.error("Error", err);
},
});
});