Hi,
in our project currently i have the following problem. I have to bind some clicks to a list of elements locking like the following:
<ul> <li class="listeelement" id="load-content-id-1"><div>listcontent</div></li> <li class="listeelement" id="load-content-id-2"><div>listcontent</div></li> <li class="listeelement" id="load-content-id-3"><div>listcontent</div></li> <li class="listeelement" id="load-content-id-4"><div>listcontent</div></li> </ul>
The click on .listelement should send a request to a specific action with specific params like element-id and something like that (-> module/action?id=1&something=something).
I wanna write a generic request class that send the request and handle all things, that have to do with the click and the request and i'm not sure if it is a good way to bind the click unobstrusive to the class .listelement and to save the action and param information somewhere in my markup OR if it is much better to bind the click by the onclick="sendRequest(action, params)".
The obstrusive-onclick-solution seems to me much easier, but i'm not sure if it is also a GOOD solution.
Would be happy if someone could give an opinion to that. Thanks.