Sending JSON to your server using jQuery is easy. Just get the data in the JSON format and specify it using the ajax
method argument's data
field.
Let's look at doAjax
again, this time modified to send our request JSON:
function doAjax() {
$('#debug').html("loaded... executing.");
var request = {
call: "kf6gpe-7"
};
$.ajax({
type: "POST",
url: "/",
data: JSON.stringify(request),
dataType:"json"
});
}
</script>
</body>
</html>