javascript - Ajax search function with pagination -
i have search form submitted using ajax. form , results work well, having issues pagination.
the pagination pulled in search results, when click link, directed search results page, has no styling.
i looking disable default behaviour of pagination. code below:
function dothesearch () { var options = { target: '#results', beforesubmit: showrequest }; $('#filter').ajaxform(options); }; function showrequest(formdata, jqform, options) { $('#results').prepend('<p class="searching">searching database</p>'); return true; } $(".pagination a").click(function(event) { event.preventdefault(); dothesearch(); });
any appreciated.
many ben
-------------- edit ----------------
the section below current results displayed:
<section id="results"> <!-- items displayed here (using expressionengine) --> </section>
i have search form performs search:
<form method="post" action="account/search-results" id="filter"> <p> <label for="keywords">enter number</label> <input type="text" name="keywords" id="keywords" value="" /> <input type="submit" name="submit" id="submit" value="search" /> </p> </form>
i have template search-results pulling search results id="results" above.
if describe onclick event of <a>
tag, have block default return. try it
$(".pagination a").click(function(event) { event.preventdefault(); dothesearch(); return false; });
Comments
Post a Comment