Adding some AJAX

My app is working pretty well now – you can add projects and actions, associate them with clients to keep the different parts of your life separate, and view actions by project, priority, date or ‘day runner’. The latter shows you any actions you have that are due (or overdue) as well as anything coming up in the next 2-3 days and all your high priority stuff. There’s also a nice journal that shows you how you’ve been doing so you can track what you’ve ticked off (very useful for a daily stand-up ‘what I did yesterday’ list).

This is currently all built on a javascript-free model. Partly because I want to be a good global citizen and allow all browsers to access the site, but also because I have a long-term aim that it will work well in a text-only browser (like lynx) for an l33t experience. So the job now is to build an API at the backend and connect up the UI so it can be a little more interactive.

I’m enjoying this.

I’m using Laravel so it was easy enough to get an API controller set up and plumb in the backend logic to create and update actions. The front-end is all using JQuery api() calls to build the data to send to the server and update the UI dynamically. So far I’ve got updating of action titles and priorities working, but based on a simple p[op-up text entry field for now. Once I’ve got the same working for projects and clients (plus added in a nice dynamic delete function) it’ll be nice to add in some UI funk, but I reckon I can get it out for people to test before I finish all that.

The only issue I had was with testing that the API calls were getting through to the app OK. I made the error of putting in a dd(‘made it!’) style call in the controller method. This works fine in the main controllers that are hooked up to a view, but these aren’t – quite where I was expecting that dd to die and display to I’m not sure. Anyway, once that was resolved it’s been a fun new journey to take and I can see a bit more clearly how the long-term architecture of the app is going to build out.

Right, on with the tasks…

Leave a Reply

Your email address will not be published. Required fields are marked *