Prior to a big upcoming job which was quoted at about 60 hours I sat down to learn a bit more about Ajax and how APIs work. Just quickly, Ajax is a new way to use the JavaScript language with jQuery which makes it very flexible and enables you to run functions and all refresh sections of the website without reloading the whole page. API is an Application Programming Interface which enables you to request information from another site with queries.
For my experiment I decided to set up an Instagram account and then try to get the images from there and post them into the side bar of this blog. It required two API calls to translate my username into a user id and then retrieve the photo information I required.
Secondly I wrote a part PHP and part Ajax web page which enables the customisatio of the script. It gets the information from a form and uses jQuery to update a div to display the script needed to show the images just like in the side bar of this blog.
While this has been a reasonably simple project I learnt a lot about how Ajax is structured compared to JavaScript and it extended my knowledge enough that I had a bit more confidence going into the big job at work. A lot of what I learnt was able to be applied at work straight away and helped me be able to concentrate on my tasks instead of having to learn basics during work hours.
The script is publically available so if you would like to use it or even just see what it does you can take a look.

0 comments:
Post a Comment