OK let's say I have this:
<!DOCTYPE html>
<html>
<head>
<style>img{ height: 100px; float: left; }</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div id="images">
Hello<br />
</div>
<script>
$.getJSON("main.txt",
function(data) {
var getTitle = title;
$.each(data.getTitle, function(i,getTitle){
$("#images").append(getTitle);
});
});</script>
</body>
</html>
it doesn't work because of var getTitle = title. I know that. But if I take out the var and replace getTitle with title which is INSIDE the JSON file.. it WILL work. But I don't want to edit three pieces of title for each code so I just make a variable so I can edit all three at once... but it doesn't work...
title- is it defined somewhere?data.titleis a string. Why are you using$.each()?