I'm using jquery to get a table of html search results via php based on a form variable and load it into a div. As the query can take a bit of time I'd like to displaying some form of loading anim but am not sure how to integrate it into my jquery.
Here's the code I have:
$(function() {
$('#search_form').submit(function() {
var data = $("#search_form :input").serializeArray();
$('#results-panel').addClass('panel-primary');
var model_id = data[0];
$("#results").html('');
$.get("/search/find_products/"+model_id.value, function (data) {
$("#results").append(data);
});
return false;
});
});
I'm still pretty new to jquery so this code is probably not the most efficient method. Any advice would be appreciated.