jQuery using $.each() with an onclick event
I'm new to jQuery (start learning 2 weeks ago
). I need to be able to loop over some methods returning values. I am loading the first value automatically, but need to be able to get the other values on 1 of 4 types of click events. Here is the code I have written so far:
-
function CheckedId() {
var datastring = "param1="+ value1+ "¶m2="+ value2;
$.ajax({
type: "GET",
url: "SpellChecker.cfc?method=getCheckIds&returnformat=plain",
data: datastring,
success:
function(response) {
var temp = $.trim(response);
var idArray = temp.split(",");
$.each(idArray, function(index){
var theId = idArray[index];
if(index == 0) {
getText(theId);
getWord(theId);
getSuggs(theId);
getOptions(theId);
} else {
//click events here
}
});
$("#visitid").html(visitId);
}
});
}
This method calls the other methods that supply the data to a set of div tags. The if statement ensures that the first set of values gets loaded automatically, but I need to be able to be able to handle click events when a user decides to move on to the next event (e.g. user ignores or changes values). Any help would be most appreciated.
Thanks,
JW