I am struggling to get this to work. I have a HTML from that was working fine and popping up with a prompt asking if I want to make the task public, but I then wanted to add another part in the make public part.
I wanted to then check a value on the form if it was made public:
echo "<label>Notify Creditor Of Update?</label>\n";
echo "<select name=\"send_options\" id=\"send_options\" class=\"\">\n";
echo "<option selected=\"\" value=\"n\">No</option>\n";
echo "<option value=\"y\" selected>Yes</option>\n";
echo "</select>\n";
So I thought that creating var notify = jQuery('#send_options').val(); would select the value from the above code.
Then IF the option selected is NOT y then popup asking if I want to Notify the client, If I select OK then notify, if I click Cancel, then do nothing about notifying them.
if (confirm('Do you wish to make this task public?')) {
// Make it public
jQuery.get('CODE_PATH_TO_EXECUTE', function (data) {
jQuery('#taskTopOut-<?php echo $rightId;?>').append(data);
});
var notify = $('#send_options option:selected').val();
alert(notify);
if((notify != 'y'))
{
confirm('Do you wish to notify client?');
{
// Notify
jQuery.get('CODE_PATH_TO_EXECUTE', function (data) {
jQuery('#taskTopOut-<?php echo $rightId;?>').append(data);
});
}
} else {
// Not notify
}
} else {
// Not public
jQuery.get('CODE_PATH_TO_EXECUTE', function (data) {
});
}
confirm('Do you wish to notify client?')) {appears to have an extra closing bracket?