Consolidating jQuery functions with multiple named selectors
<p>I'm looking for a techniuqe similar to a switch function in PHP so I can use a single function for multiple named selectors. Additional code would be added based on which selector calls the function.</p>

<p>My example is a 'Save' button along a 'Save And Close' button where the latter has additional code to close an accordion.</p>

<p>If the 'Save' button is clicked it calls this:</p>

<pre><code>    $('form[name=experienceForm]').submit(function(eve) {

            eve.preventDefault();
            tinyMCE.triggerSave();

            var FormData = $(this).serialize();
            var requestThis = $(this);
            var inputCom = $(this).find('input[name=inputCom]').val();
            var inputTitle = $(this).find('input[name=inputTitle]').val();

                $.ajax({
                        type : 'POST',
                        url : '&lt;?php echo site_url('resume/update'); ?&gt;',
                        data: FormData,
                        dataType: "html",
                        context : $(this),
                        success : function(msg){
                        requestThis.closest('.item').children('h3').children('a').text(inputCom+' : '+inputTitle);

                        if(msg != '') {

                        showNotice(msg);
                        }

                        },

                        error: function(msg){
                        alert('FAIL '+msg);
                        }
                    }); 


    });
</code></pre>

<p>I would like the 'Save and Close' button to do the same as above with this added:</p>

<pre><code>    $('input[name=experienceClose]').click(function(eve) {

        eve.preventDefault();
        tinyMCE.triggerSave();          
        $(this).parent().parent().parent().parent().parent().parent().parent().parent().parent().accordion({active:"false"});
    }); 
</code></pre>
