var checkFormulaName = function() { var returned; this.getFormula = function(name) { return $.ajax({ url: '/formula/msp/check', type: 'POST', data: 'name='+name, dataType: 'json', async: false }).responseText } }