What am I doing wrong?
For some reason the success function's html.responseText is a verbatim copy of the domain's index.php. This call isn't even made in index.php, nor does it address it—what's going on?
The Ajax:
var k = '123abc';
$.ajax({
URL: 'php/dbInsertKey.php',
type: 'POST',
dataType: 'JSON',
data: {
key: k
},
success: function(html){
console.log(html);
}
});
dbInsertKey.php:
$key = (string) $_POST['key'];
echo ($key);
instead of returning '123abc', it returns a string that contains the domain's index.php, line for line. And for what it's worth, this happens no matter what the supplied URL is: 'php/nonsense.lol' will give the same result.