I have a search form in which a user enters the keyword and the results are displayed on the page. Everything works fine except for the fact that when the user clicks on the 'next' button, the paging panel also disappears when the page is loaded through AJAX to load the page
Search.html:
& lt; Name of the form = " Myform" class = "wrapper" & gt; & Lt; Input type = "text" name = "q" id = "q" onkeyup = "show page ();" Class = "txt_search" /> & Lt; Input type = "button" name = "button" onclick = "showPage ();" Class = "button" /> & Lt; P & gt; & Lt; / P & gt; & Lt; Div id = "txtHint" & gt; & Lt; / Div & gt; & Lt; / Form & gt;
Ajax:
var url = "search.php"; Url + = "? Q =" + str + "and page =" + Page + "& amp; List ="; Url + = "& sid =" + Math.random (); XmlHttp.onreadystatechange = stateChanged; XmlHttp.open ("GET", URL, true); XmlHttp.send (zero); Function stateChanged (if (xmlHttp.readyState == 4 || xmlHttp.readyState == "full") {document.getElementById ("txtHint"). InnerHTML = xmlHttp.responseText;} // end if} // end function
search.php:
$ self = $ _SERVER ['PHP_SELF']; $ Limit = 3; // results per page $ adjacents = 2 ; $ NUMPAGES = Plotting ($ totalrows / $ border); $ Query = $ query. "ID quotes by order quotes" ($ page-1) * $ range, "$ range"; $ result = mysql_query ($ query, $ Conn) or die ('Error:' .mysql_error ());? & Gt; & lt; div class = "search_caption"> search results & lt; / div & gt; & lt; div class = "search_div "& Gt; & lt; table class =" results "& gt; & lt; php while ($ row = mysql_fetch_array ($ P Consequence, MYSQL_ASSOC)) {$ cQuote = highlightwords (htmlspecialchars ($ line ['cQuotes']), $ search_result);? & Gt; & lt; tr & gt; display results ... & lt; / tr & Gt; & lt ;? php}? & Gt; & lt; / table & gt; & lt; / div & gt; & lt; bell & gt; & lt; div class = "searchmain" & gt; & Lt ;? Create and print the php // navigation bar $ nav = ""; $ Next = $ page + 1; $ Prev = $ page -1; If ($ page & gt; 1) {$ nav. = "& Lt; an onclick = \" show page ('', '$ prev'); On return; \ "Href = \" $ self? Page = ". $ Prev." & Amp; Q = ".urlencode ($ search_result)." \ "& Gt;
Definitely what you mean is just the result page of the whole page in the show page function Do not change.
Comments
Post a Comment