I'm using following code to send the form through ajax
<script>
$(document).ready(function(){
$("#update-settings").submit(function(e) {
var url = "files/jquery-pages/page_jquery_settings.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#update-settings").serialize(), // serializes the form's elements.
success: function(data)
{
$("#success-settings").hide().html(data).fadeIn('slow');
}
});
e.preventDefault(); // avoid to execute the actual submit of the form.
});
});
</script>
<div id="success-settings">
</div>
and this is working fine so far.
My php page is loking like this:
<?php
if(isset($_POST['change_password']) == $settings_btn_change_password)
{
echo "The password has been changed";
}
if(isset($_POST['update_email']) == $settings_btn_update_email)
{
echo "This is email update";
}
?>
The problem is when i hit Submit button change_password example it´s displaying both "The password has been changed" and "This is email update".
I just want to show "The password has been changed" if I have hit that button.
Any ideas why?
Cheerz :)
