site/templates/main.php:
<html>
...
<body>
...
<?php
if ($page->get("title") == "Home")
{
echo "<script type='text/javascript'>
var stuff = 1;
$.ajax({
type: 'POST',
url: '" . $config->urls->templates . "somefile.php',
data: {'inspection': stuff},
dataType: 'json',
success: function(returnedData, status, request)
{
alert('Yay! ' + returnedData);
},
error: function()
{
alert('crap...');
}
});
</script>";
}
?>
</body>
</head>
Where url is '/site/templates/somefile.php'site/templates/somefile.php:
<?php
if($config->ajax)
{
json_encode("Hello");
exit;
}
?>
However, this fails with 403 (Forbidden).
Placing the contents of somefile.php at the top of main.php and replacing the ajax url with '$page->url' works just fine.
Is there any reason why we would be unable to post to another php script?
Thanks!





Find content
Not Telling
