Reputation: 1037
I have a ajax call to server. on success i am reloading the page with search result. Code for the same is:
function searchData(){
$.ajax({
type : "POST",
url : "/tool/search",
data : "empId=" + $(".empId").val() + "&submit=Search",
success : function(data) {
location.href="/tool/search?empId="+ $(".empId").val() +"&submit=Search";
}
});
}
But, it is taking so much time for reloading the page, while I am receiving the data from server before this [ getting in firebug]. Can any one help on this. On success i have to load the same jsp page from where the request is generated.
Upvotes: 1
Views: 124
Reputation: 44854
The above jquery ajax is very strange, why do you reload the servlet query after sucessfully performing an ajax query. The below seems more logical
$.ajax({
type : "POST",
url : "/tool/search",
data : "empId=" + $(".empId").val() + "&submit=Search",
success : function(data) {
// use the data
// maybe like
$(".results").html (data);
}
});
Upvotes: 3