Assuming I understand your question correctly, it is possible. This is how I would do it (not sure how much this differs from the way you mentioned). Obviously you would need to change your page callback function, which you set for the tab in hook_menu(), to return a json object rather than a rendered page.
At the end of your page callback function you should add something like this:
// Return the rendered view in a JSON object. The object will contain a property
// named “contacts”, which containes the rendered view. This will be sent to the
// browser and is accessable to javascript.
return drupal_json_output(array('contacts' => $view));
exit;
You would then need to include some javascript on the client-side to send an ajax request to the server using the URI/path you set for the tab in hook_menu. This same client-side javascript would then process the returned data.
currentMenuLink.click(function() {
var updateContacts = function(data) {
// The data parameter is a JSON object. Do something with the returned data here.
};
// Send ajax request.
$.ajax({
type: 'POST',
url: this.href, // Which url should be handle the ajax request. This is the url defined in the <a> html tag
error: function() {
$('#namecards-get-contacts-by-nid-row-' + currentNid).show();
$('#namecards-get-contacts-by-nid-cell-' + currentNid).html($('<div class="">An error has occurred while retrieving the list of contacts. Please try again. If the problem persists, please inform your website administrator.</div>'));
},
success: updateContacts, // The js function that will be called upon success request
dataType: 'json', //define the type of data that is going to get back from the server
data: 'js=1' //Pass a key/value pair
});
// return false so the navigation stops here and not continue to the page in the link.
return false;
}
});