Regarding this code:
var htmlitems = "";
$.getJSON("getjsonvin.aspx?v=1B3LD76M48N121862&c=1410", function (data2) {
var options = JSON.stringify(data2[0].dealer_options);
options = options.replace("[", "");
options = options.replace("]", "");
options = options.replace(/['"]+/g, '')
var optres = options.split(",");
for (var i = 0; i < optres.length; i++) {
htmlitems = htmlitems + "<li>" + optres[i].toString() + "</li>";
}
alert(htmlitems);
return htmlitems;
});
alert(htmlitems);
The FIRST alert shows me my html <li>
in the alert box that grabbed from screwy json... (the json comes to me screwed up so I have to do all the replacing crap...) BUT I'm getting what I want in the htmlitems variable (FIRST ONE)
The SECOND alert, it's like htmlitems is blank again??? Hopefully someone in la, la programming land can tell me what's wrong?