building dynamically created Clickable Divs JQuery Ajax -
The XML file is generated from a DB resultet. It is all working properly. The AJAX call is removed with a button click, but I want to change it.
I have another div that is populated with a list of titles. What do I want to do when a title is clicked, then the main content divi is updated with data related to that title should be done. I was wondering what would be the best way to do this. Should I create a clickable device that calls AJAX? And if so, how can I differentiate which div main content is clicked in the code of the code I hope this makes sense ... here is my code for the population list < / P>
$ (document) .ready (function () {$ ("# getData"). Click (function () {var $ title = ""; $ .get ("phpAjaxMovieListingTotal.php ", Function (XML) {$ ('line', XML) .each (function (i) {$ title = $ (this) search (" title "). Text ();}); $ (" # movieliving content Div "). Html ($ Title);});});});
OK, for a list of clickable devices, loaded with xml, View demo Here is the code: FitTitLink (title) {Warning ("Movie Title '" + Title + "' Clicked ');} GetMovies () {$ .post ("THEXML.php", function (data) {$ ('row title', data) .each (function (i) {var title = $ (this) .text (); $ ('# container JavaScript: MoviteLink (\ '+ + + + title +' \) "& gt; '+ title +' ';);); Andend (' & lt; div onclick = ') Javascript: )}}, 'Xml'); } $ (Document) .ready (function () {GetMovies ();});
Comments
Post a Comment