I have a common validation function
function connect_and_update_destination() {
var flag = true;
// Validate IP
if (!validate_ip_address()) {
alert(protect.lang.enter_valid_ip);
return;
}
if ($('#pjm_alias').val() === '') {
$('#pjm_alias').focus();
alert(protect.lang.enter_alias);
return;
}
if ($('#pjm_auth_name').val() === '') {
$('#pjm_auth_name').focus();
alert(protect.lang.enter_auth_name);
return;
}
if ($('#pjm_auth_password').val() === '') {
$('#pjm_auth_password').focus();
alert(protect.lang.enter_auth_pwd);
return;
}
var ip = $('#pjm_ip1').val()+'.'+$('#pjm_ip2').val()+'.'+$('#pjm_ip3').val()+'.'+$('#pjm_ip4').val();
return establish_connection(ip, $('#pjm_alias').val(), $('#pjm_auth_name').val(), $('#pjm_auth_password').val());
}
After successful validation it always return establish_connection(), My problem is that am calling this connect_and_update_destination() like this,
function first_call(){
connect_and_update_destination();
}
function second_call(){
connect_and_update_destination();
}
When first call i need to return after successful validation establish_connection(), But when ever i called its using second function [second_call()] it should not return establish_connection() insted of return establish_connection() i need to only return . But how can i do this, Means i dont want to enter establish_connection() when ever i call using second_call().
Thanks in advance.