xml - Parsing JSON with AJAX - show random item of the JSON and update after an amount of time -
I am able to parse AJON with AJAX, but at the moment it shows all names from JSON.
I have only seen one name and after a while I want to see another one.
Ajax code:
$ (document)) .ready (function () {parseJson ();}); Function parseJson () {$ .ajax ({url: 'data / members.json', dataType: 'Jason', success: work) {succes (data);}, error: work () {window.alert ( "Error");}}); }; Function succes (dataObj) {var counter = 1; $ .each (DataSub Members, Functions (IndexData, Validata) {var html string = "" htmlString + = '& lt; Article class = "MemberInfu" Data-object = "' + Counter +" "& gt; ;; HtmlString + = "& lt; div class = '' & gt; & lt; p & gt;" + valueData.Firstname + "+ valueData.Surname +" & lt; / Div> "htmlstring + =" "; $ (" # member "). Attachment (html string); counter ++;}); } .append instead of using
>. Set the html and a startling timeout so that it is the cycle through the names displayed:
var timer = 0; $ .each (... setTimeout (function () {var htmlString = ""; / * snip * / $ ("# member"). Html (htmlString);}, timer + (indexData * 2000))};
Comments
Post a Comment