I'm having trouble getting a local storage variable to store the correct value. Its essence is that I want to display the contents of a local variable, and then, if the user clicks, it extracts data from the XML file, saving it in a local variable.
The problem is that it does not save the correct local variable. I tried the syntax to make it work, and I'm not in ideas.
The site for testing is located at http://web.engr.oregonstate.edu/~todtm/assignment2.html
Script Code:
function startAjax() { $("#clickme").text("Calling server"); $.ajax( { url: "xmlpage.xml", success: callbackFunction, error: errorFunction }); } function callbackFunction(data, info) { var titles = $(data).find("title"); if (titles && titles.length) { $("#results").text("result:" + titles.text()); localStorage.setItem('titles',
source share