Hey all,
I'm having some problems with some ajaxy stuff and was hoping someone
can point me in the right direction.
The project is as follows:
I'm trying to take this page
(http://lg8eg4nk4x.search.serialssolutions.com/?S=T_W_A&V=1.0&N=100&L=LG
8EG4NK4X&C=test) and grab the issn and query my server which returns
whether the issn is peer reviewed or not.
I'm using jquery. Here is the piece of my js code that cycles through
the issn numbers:
if (allHTMLTags[i].className==theClass) {
var originalTag = allHTMLTags[i].innerHTML;
var issn =
originalTag.replace("(","").replace(")","");
alert('test');
$.getJSON("http://library.paulsmiths.edu/issnsearch/ispeerreviewed.php?i
ssn=" + issn + "&jsoncallback=?",function(json, textStatus) {
alert("test2");
allHTMLTags[i].innerHTML= "(" + issn +
") Peer Reviewed: " + json.peerreviewed;
});
}
}
}
The problem is if I remove the "alert" items that print out "test and
"test2", the program cycles indefinitely, hits my server a million
times, and freezes my browser. With the alerts, it works as expected. I
suspect the script is running too fast and is unable to get a response
from the $.getJSON query in time before it hits the innerHTML command.
How is this usually handled in ajax stuff? I'm new to it all.
Thanks,
Mike Beccaria
Systems Librarian
Head of Digital Initiatives
Paul Smith's College
518.327.6376
|