php - AJAX call success but throws Undefined index error -
i have ajax call passes data php file, createtest2.php, below.
but createtest2.php file throws error
"notice: undefined index: aaa in c:\xampp\htdocs\testproj\test\createtest2.php on line 2
caller.php
$(document).ready(function(){ $("#button_submit").click(function() { $.ajax({ type:"post", url:"createtest2.php", data:{aaa : "unit_test"}, success:function() { alert("success"); } }); }); });
createtest2.php
$test_name = $_post['aaa'];
there nothing wrong on code/script. tried on localhost , works.
make sure error reporting configured correctly because printing notice passed ajax result.
to remove use these on top of php code of createtest2.php
: (before call anything, after first php opening tag)
<?php ini_set("display_errors",0); error_reporting(0);
take note notice
, not error
indicated on question. hope helps. ;)
** update: people recommended fix notices instead of hiding them, know..
Comments
Post a Comment