How to detect if $_POST
is set in Ajax calling PHP file and check it?
Is there any way I can see the Ajax Flow!
Right now I detect it like this:
if(isset($_POST['value']))
Updating value in DB or using Javascript Alert.
How to detect if $_POST
is set in Ajax calling PHP file and check it?
Is there any way I can see the Ajax Flow!
Right now I detect it like this:
if(isset($_POST['value']))
Updating value in DB or using Javascript Alert.
You could make in your PHP file like
echo" <p id='detect'>"; echo (isset($_POST['foo'])) ? $_POST['foo'] :''; echo "</p>"
Now, you could simply use Js, to detect if there is anything inside the <p>
tag, using innHTML
var data = document.getElementById('detect').innerHTML;
if(data === ''){
// means no post is made
}else{
// post was made
}