O'Reilly logo

Mastering jQuery UI by Vijay Joshi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting comments for a post

We have already displayed the posts and a link to view comments with each post. Each of these links has a CSS class named viewComments. In the init method, we have defined an event handler for the click event on this selector. This event handler calls the method getJSONFromAPI with two arguments. The first argument is the set of string comments that will let getJSONFromAPI know that the API request has to be made for comments. The second parameter is the comments id for that particular post, which we assigned using the data-commentsid attribute. The event handler for viewComments gets this value and passes it as a second argument to getJSONFromAPI. We have already defined and discussed the working of getJSONFromAPI ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required