pensions and investments search engine
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


I replicated's search engine using their API.

This code is live here.

I chose to use javaScript, jQuery and PHP because I knew how $_GET, simplexml_load_file and xpath worked in PHP, and how window.location.href worked in javaScript.

Code Explanation: In search.js you'll see that I wrote a custom function to redirect the user based on what sort button they pressed (date or relevance). I made it so that if sort=date or sort=rel is in the URL, the corresponding sort button would be disabled. In addition, I made it so that if an option was selected, the user would be redirected to that value and the corresponding option would be selected after the search was done. I also, redirected the user based on what option they picked, and that option stays selected after the search.

In style.css you'll see how I styled the page. I tried my best to keep everything intuitive, and easy on the eyes.

In search.php you'll see that I used Xpath to query the API. In addition, I made it so that the search value would appear in the input search box after the search has been made. I also, created my own pagination dropdown.

Note: When I used xpath to get the data from the API, I noticed that the results returned were the same if the URL wasνm=20&start=20 orνm=20&start=40. I thought this was something wrong with my code, but I made sure I looked at the API documentation and it seemed that &start=20 and &start=40 were correct. I then went toνm=30&sort=rel&printXML=true andνm=30&sort=rel&printXML=true. What I saw on both pages were very similar, so I believe there's something wrong with the API.