<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jacob Bodkin on Medium]]></title>
        <description><![CDATA[Stories by Jacob Bodkin on Medium]]></description>
        <link>https://medium.com/@jacobbodkin?source=rss-f881b2bde722------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fdCUl0bIReFSlOG6.</url>
            <title>Stories by Jacob Bodkin on Medium</title>
            <link>https://medium.com/@jacobbodkin?source=rss-f881b2bde722------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 07:00:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jacobbodkin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Getting to the Next Page using the Reddit API]]></title>
            <link>https://medium.com/@jacobbodkin/getting-to-the-next-page-using-the-reddit-api-9f82a26ae962?source=rss-f881b2bde722------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f82a26ae962</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jacob Bodkin]]></dc:creator>
            <pubDate>Thu, 30 Mar 2017 02:49:11 GMT</pubDate>
            <atom:updated>2017-03-30T02:49:11.780Z</atom:updated>
            <content:encoded><![CDATA[<p>Convoluted and involved are the two words I would use to describe Reddit’s explanation of pagination in their API documentation. After spending almost an hour trying to get this should be simple feature working, I was able to put together the correct sequence of code to make the pages hop back and forth. Hopefully my loss of time and hair will save yours.</p><p>First start by creating some type of trigger event. I was using simple previous/next links with click events shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*ogh3EADj7w_7_OehnU-9UA.png" /></figure><p>The point of passing the switched true/false booleans was so that we would know which direction the user was wanting to go (previous or next) in the function as you can see in the function below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bgcPOCLuLBjQEMw4z2VTJA.png" /></figure><p>Make sure to set the count global variable to zero, and limit to however many articles you want to show up. In the ‘done’ portion of the ajax call, you should then increment the count up or down by what is essentially the limit (I used the number of responses returned just in case the amount was less than the limit).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aqyTtZx02EJOsFhuIAlVIA.png" /></figure><p>The trick to the next/previous pagination switch comes in with the after and before keys in the data object of the ajax call. As long as the user keeps hitting next, continuing to increment the count and updating the after value to the previous returned ‘before’ value, the pages will keep working. However previous is different. To use previous, you must call in the previous value to previous AND the after value to after while also de-incrementing.</p><p>It sounds so simple because it is. But The Reddit API docs would never let you know that…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f82a26ae962" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>