Hello guys i am trying to create a search input that will search all my posts and display the matched ones:
I have an working code that looks like this:
html:
<form action="" method="post">
<input type="text" id="search_posts" value="" />
</form>
jquery:
$(document).ready(function()
{
$("#search_posts").keyup(function()
{
var posts = $(this).val();
$(".posted_post").each(function()
{
if ($(this).text().search( new RegExp(posts, "i") ) < 0)
{
$(this).fadeOut();
}
else
{
$(this).show();
}
});
});
});
but now i'm not doing any db search and stuff... can i transform this using ajax? how would that look?