Basically what I am trying to achieve with this section of code is to search with a term on twitter, and then see if the second term is included in any of the search results. tally those up and graph them with the Google charts api. it seems indexOf, is not working because when i declare term and term2 to be both "test" It still only adds to notcontains.
$.ajax({
url: 'http://search.twitter.com/search.json?q=' + term2 + '&lang=en&callback=?',
dataType: "json",
async: false,
success: function(data) {
var data = data.results;
var addhtml = "<ul>";
for (var i = 0; i < data.length; i++) {
addhtml += "<li><a href='http://twitter.com/" + data[i].from_user + "'>@" + data[i].from_user + "</a>: " + data[i].text + "</li>";
compare = JSON.stringify(data[i].from_user);
if (compare.indexOf(term) >= 0) contains += 1;
else notcontains += 1;
}
addhtml += "</ul>"
html += addhtml;
drawChart()
$('.content').html(html);
$('.counts').html(contains + " " + notcontains);
}
});