Skip to content
Advertisement

how to get the data from ajax request then use it in php conditional statemtn

I want to create an ajax post request that gets the value of the radio button then use it in a PHP conditional statement.

So far i have tried this code (all code is from one php file):

JavaScript
JavaScript
JavaScript

the alert message shows the value of the radio button when I clicked them but the echo in PHP condition is not showing.

Advertisement

Answer

You are using alert(subject); which will just alert the value of the radio button as you’ve mentioned.

Change that line to alert(response); to alert the response on success.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement