Problem with return value from JQuery call
I have a JQuery script which calls a PHP file (should it be a PHP function instead?) The script only shows the "not working"-alert box, and alert(output) displays nothing.
The PHP file can return only 2 values, ('1' or '0')
This is my JQuery code:
<script src="
http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script>
function checkCountry(country)
{
$.ajax(
{
url: 'ajax/getCountryState.php',
data: {country: '1'},
type: 'POST',
success: function(output) {
if (output == 1) alert('success');
else alert('not working');
alert(output);
}
});
}
</script>
the PHP function just returns the '1' or '0' value, I mean it doesn't do any converting to JSON or anything like that
The goal is when user has made a selection in a select list I should update the form based on what the user selected.