mandag den 9. januar 2017

Interesting ajax php $_POST problem

<b>Notice</b>: Undefined index: method in <b>C:\x\htdocs\data\functions\main\sub\sendemail.php</b> on line <b>2</b><br />

If you make a post request via ajax:
jQuery.ajax({
       type: 'POST',
       url: 'data/functions/main/sub/createuser.php',
       data: postdata,
                dataType: 'JSON',

and did not define a "method" and you do not explicilty said that you wanted to send a method call in a file.
The first file has:
ob_start();
include $_SERVER['DOCUMENT_ROOT'] ."/data/functions/main/sub/sendemail.php";
ob_end_clean();
I this file it does not have a  $_POST["method"]; php call.
but it still references it:
In "sendemail.php" it has a method call:
echo $_POST["method"];
This still runs even thought you did not specifically said it.

Ingen kommentarer:

Send en kommentar