<?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 Michael Ameyaw on Medium]]></title>
        <description><![CDATA[Stories by Michael Ameyaw on Medium]]></description>
        <link>https://medium.com/@mkojoa?source=rss-2bef873b79a9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HpQ41OwztHy8FqPTdt1Oaw.jpeg</url>
            <title>Stories by Michael Ameyaw on Medium</title>
            <link>https://medium.com/@mkojoa?source=rss-2bef873b79a9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:53:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mkojoa/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[How to pass and retrieve argument from the URL ( Uniform Resource Locator) with JQUERY]]></title>
            <link>https://medium.com/@mkojoa/how-to-pass-and-retrieve-argument-from-the-url-uniform-resource-locator-with-jquery-77e0f6a48d54?source=rss-2bef873b79a9------2</link>
            <guid isPermaLink="false">https://medium.com/p/77e0f6a48d54</guid>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Michael Ameyaw]]></dc:creator>
            <pubDate>Wed, 28 Nov 2018 11:36:38 GMT</pubDate>
            <atom:updated>2018-11-28T22:11:43.340Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to pass and retrieve argument from a URL ( Uniform Resource Locator) with JQUERY</h3><p>If you are here, then I guess you are facing the problem of either passing agurment in URL and retrieving these arguments back from URL in a different page. However, I am glad to inform you that I have also faced that problem and able to resolve.</p><p>In this tutorials, I am going to teach you how to pass arguments in a URL and retrieve them back from the URL.</p><p><strong>Example: </strong>Assuming you have a web page that displays all the list of current event in your location from an API, and when a user clicks on each of the listed events, a single event is displayed based on the event they clicked.</p><p>In other to achieve the example above,</p><h3><strong>STEP 1:</strong></h3><p>we have to pass the id of the clicked event by passing the id of the clicked event in URL</p><pre>//Current Page [www.mysite.com]<br>const url = &#39;http://michael.com/api/v1/events&#39;; //api url</pre><pre>$.getJSON(url, (data) =&gt; {</pre><pre> $.each(data, <strong>function </strong>() {<br>   // the event div and append;<br>   $(&#39;#events&#39;).append(`<br>      &lt;a href=&quot;event_details.html? id=${<strong>this</strong>.id}&quot;&gt;${<strong>this</strong>.title}&lt;/a&gt;<br>   `)<br>  });<br>});</pre><h3><strong>STEP 2:</strong></h3><p>We can now retrieve the id of a clicked event from URL by</p><pre>//Do this in the next page (single event page)<br>$.getUrlParam = (retrive_from_url) =&gt; {<br>    <strong>var </strong>results = <strong>new </strong>RegExp(&#39;[\?&amp;]&#39; + retrive_from_url + &#39;= ([^&amp;#]*)&#39;).exec(window.location.href);<br>    <strong>return </strong>results[1] || [0]<br>};</pre><pre><strong>const </strong>event_id = $.getUrlParam(&#39;id&#39;); //getting the id from the url<br><br>$.getJSON(`api/events/${event_id}`, (data) =&gt; {<br>    console.log(data) //desplay the data from the server<br>})</pre><h3>Congratulations!</h3><p>Hopefully, now you can easily pass arguments in a URL and retrieve them back from the URL. If you need help, just drop a comment and I will get back to you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77e0f6a48d54" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>