$ajax_check = " var postData = { 'field' :'username', 'table' : 'api_user', 'value' : document.".$form_name.".txt1.value, }; $.ajax({ url: '/publics_home/api_check_existing', type: 'POST', data: postData, success: function(result) { if (result == 1) { document.getElementById('divError1').innerHTML = 'This username is already existed!'; window.location = '/".$this->uri->uri_string()."#".$form_name."'; } else { document.forms['".$form_name."'].submit(); } } }) "; $ajax_check = " var postData = { 'field' :'username', 'table' : 'api_user', 'value' : document.".$form_name.".txt1.value, 'except_value' : document.".$form_name.".txt6.value, }; $.ajax({ url: '/publics_home/api_check_existing_except', type: 'POST', data: postData, success: function(result) { if (result == 1) { document.getElementById('divError1').innerHTML = 'This username is already existed!'; window.location = '/".$this->uri->uri_string()."#".$form_name."'; } else { document.forms['".$form_name."'].submit(); } } }) ";