I have got a website where people can share activities just like Twitter, users can Like them and Comment them.
Basically there is a filter that filters the list on date, so for example, show me all activities from today, what will happen is we make a request to our ajax controller, and it will send me the json for each activity based on the filter criteria, I got that all working.
How it works now is, when you press a filter criteria for example "today activities" we call the javascript method LoadActivities(filter); and it will just call the json, parse it and display all activities, now the question is what would be the best way to handle Likes and Comments, how I got it in mind was:
Each like button has the id "ActivityLike_{ACTIVITY_ID}" then make a click event, and split by '_' and voila got the id of the activity, but once the user pressed the like button, it needs to re-render a single activity on the page, because "like" has to change to "not like anymore" etc. Same with commenting.
So how do I build this list, not using splits '_' and other nasty solutions, but how can I do this in a proper clean way? Same question with jQuery "live" events, are they good to use or is there a work around?
Thanks for reading.