Creating Next prev with ajax ?
I am planning to create a result page with ajax includign function next / prev for limit the result.
Example.
Showing results 6 - 10 of 15
PREV 1 2 3 NEXT
6 - Alex - Business
7 - Edmond - IT
8 - Alica - Design
9 - Shook - Art
But i only can create it with link to another page. Can some 1 give me some tips on ajax without refresh and can be click on the prev / next ?
some of my code is below
<cfquery datasource="#ds#" name="test">
SELECT *
FROM employee
</cfquery>
<cfset Result_Per_Page="5">
<cfset Total_Records="#test.recordcount#">
<cfparam name="URL.offset" default="0">
<cfset limit=URL.offset+Result_Per_Page>
<cfset start_result=URL.offset+1>
<cfoutput>
Showing results #start_result# -
<cfif limit GT Total_Records>
#Total_Records#
<cfelse>
#limit#
</cfif>
of #Total_Records#
</cfoutput>
<cfset URL.offset=URL.offset+1>
<cfif Total_Records GT Result_Per_Page>
<br>
<cfif URL.offset GT Result_Per_Page>
<cfset prev_link=URL.offset-Result_Per_Page-1>
<cfoutput><a href="#cgi.script_name#?offset=#prev_link#">PREV</a>
<br />
</cfoutput>
</cfif>
<cfset Total_Pages=ceiling(Total_Records/Result_Per_Page)>
<cfloop index="i" from="1" to="#Total_Pages#">
<cfset j=i-1>
<cfset offsetvalue=j*Result_Per_Page>
<cfif offset_value EQ URL.offset-1 >
<cfoutput>#i#</cfoutput>
<cfelse>
<cfoutput><a href="#cgi.script_name#?offset=#offset_value#">#i#</a></cfoutput>
</cfif>
</cfloop>
<cfif limit LT Total_Records>
<cfset next_link=URL.offset+Result_Per_Page-1>
<cfoutput><a href="#cgi.script_name#?offset=#next_link#">NEXT</a>
<p></p>
</cfoutput>
</cfif>
</cfif>
<cfloop query="test" startrow="#URL.offset#" endrow="#limit#">
<cfoutput>#ID# - #name# - #dept#</cfoutput> <br>
</cfloop>
