I have the following script which requests data through AJAX:
$(document).ready(function(){
$('#input').keyup(function(){
sendValue($(this).val());
});
});
function sendValue(str){
$.post("ajax.php",{ sendValue: str },
function(data){
$('#display').html(data.returnValue);
}, "json");
}
I just want to show a DIV while the request is being made, and hide it when the data comes back. I've tried this:
$("#loading").ajaxStart(function(){
$(this).show();
})
.ajaxStop(function(){
$(this).hide();
});
But it didn't show or hide, it was always displayed.