How to update a DIV without giving refresh on the whole page?
Previously in rails 2.3.10, the 'remote_function' was used to update an existing div.
Now in rails 4.2, since you no longer have the remote_function, how can I do that?
Ex: When entering an ID
' text_field: individual_id, (something like: update = >' search ')% >'
The name of the person from that ID will be displayed
div id = 'search'
'<% = h @ molecular_bio.individual & @ molecular_bio.individual.name% > '
/ div '
I tried to use this command in javascript, but I do not know much about js.
<script src="http://code.jquery.com/jquery-latest.js"></script>
<scripttype="text/javascript">
var live_search_timer = null;
function start_live_search(){
clearTimeout(live_search_timer);
live_search_timer = setTimeout(function(){
$('#search').fadeOut('slow').(comando para dar um update na div).fadeIn('slow');
}, 2000);
}
</script>
<%= text_field :individual_id, :onKeyPress => "start_live_search()" %>