can json and ajax work as api code example
Example: jquery ajax json
$.ajax({
method: "POST",
url: "some.php",
dataType: "json",
data: {}
}).done(json => console.log(json));
$.ajax({
method: "POST",
url: "some.php",
dataType: "json",
data: {}
}).done(json => console.log(json));