I have an object ajax_tryit which calls ajax_generic ans sends it 3 functions. They are all named.
Would it be better (more efficient, a tad faster) to use anonymous functions.
Application...This is the ajax call back function which can do 3 things, pass, fail, or undefined(usually a php error).
function ajax_generic( server_response_text, pass_func, fail_func, undefined_func )
{
var aml_status = check_aml( server_response_text.slice( 0, 6 ) );
if( aml_status === Constant.AML.PASS )
{
pass_func();
}
else if( aml_status === Constant.AML.FAIL )
{
fail_func();
}
else
{
undefined_func();
}
}
function ajax_tryit( server_response_text, html_div )
{
var pass_func = function {window.location.reload()};
var fail_func = function(server_response_text) { alert( 'ajax_tryit(): ' + server_response_text ) } ;
var undefined_func = function(server_response_text) { alert( 'php error: ' + server_response_text ) };
ajax_generic( pass_func, fail_func, undefined_func );
}