In my case I needed to get the value from a rel attribute and then parse it as a function, this worked for me.
$jq('#mainbody form').submit(function(e){
var formcheck = $jq(this).attr('rel');
if (typeof window[formcheck] === 'function'){
formok = window[formcheck]();
e.preventDefault();
}
});
function maincheck(){
alert("Checked");
return false;
}
and the form