I have this code:
$(document).ready(function() {
$("#team-search").keyup(function() {
if($("#team-search").val().length > 0) {
$("#search-results").slideDown(300);
}
else {
$("#search-results").slideUp(300);
}
$.post("team-search.php",{team: $("#team-search").val()},function(result) {
$("#search-results").html(result);
});
});
});
and everything works; it sends the post request with the team:$("#team-search")
value and it prints the results into $("#search-results")
.
but after typing about 20 characters, it stops printing the result and I check the error log and it says this: [Error] Failed to load resource: The network connection was lost. (team-search.php, line 0)
every time you type a key.
What am I doing wrong? Or what should I fix? Why is this happening?
my network connection is really and everything else works fine
That's definitely a problem on the server side. Check network tab in developer tools (if you use chrome/safari) to see what's happening with network.
List of the problems that may be the case:
P.S.: Please specify more details like: the script you use, your browser, your server software and location (local / remote).