Different Action Depending on val()

Different Action Depending on val()

Im trying to do a different action depending on an inputs value. If the val is subscribe then it adds the record to the database and changes the val to unsubscribe. If the val in unsubscribe then it removes it from the database and changes the val to subscribe. however when the val is subscribe and clicked it inserts the info to the database and displays the new val(unsubscribe) but if it is clicked again without a page refresh the script still thinks the val is subscribe. I have alerted the val and it shows that it is subscribe even though the val is unsubscribe. If i do a page refresh then everything works, but i dont want to have a page refresh.

  1. $j('.notify').click(function(){
            if($j('.notify').val('Subscribe'))
            {
                var method = 'subscribe';
            }
            else if($j('.notify').val('Unsubscribe'))
            {
                var method = 'unsubscribe';
            }
            jQuery("#process_info").removeClass().addClass('loading').html("Loading...").fadeIn("slow");   
            $j.post('<?php echo $template->site_root; ?>modules/notify_process.php',
            {
                method        :    method,
                tid            :     '<?php echo $topic_id; ?>',
                user_name    :     '<?php echo $user->user_name; ?>'
            }, function(data)
            {
                if(data == 1)
                {
                    alert($j('.notify').val());
                    if($j('.notify').val('Subscribe'))
                    {
                        $j('.notify').val('Unsubscribe');
                        jQuery("#process_info").removeClass().addClass('subject_okay').html("Subscribed Successfully!").fadeIn("slow");
                    }
                    else if($j('.notify').val('Unsubscribe'))
                    {
                        $j('.notify').val('Subscribe');
                        jQuery("#process_info").removeClass().addClass('subject_okay').html("Unsubscribed Successfully!").fadeIn("slow");
                    }
                }
                else
                {
                    jQuery("#process_info").removeClass().addClass('subject_error').html(data).fadeIn("slow");
                }
            });
        });



































Anyone have any ideas?