function checkSearchForm() { if ( $('search_text').value == '' ) { showSearchError('Заполните поле'); return; } Form.disable('search_form'); showSearchError(_msg_sending2); var req = new Ajax.Request( "check_search", { method: "post", parameters: { text:$('search_text').value }, onComplete: function( req ) { var json = eval( '( ' + req.responseText + ' )' ); Form.enable('search_form'); if ( json['status'] == 'done' ) { document.location.href = 'search&text='+valueOf('search_text'); } else { showSearchError(json['status']); } } } ); } function showSearchError(msg) { $('search_error').innerHTML = msg; }