I've checked the other answers to similar questions - but so far no luck.
I have the following code:
$("#alphaindex").click(function(e) {
var item = $(this).attr("title");
e.preventDefault();
$.getJSON("getContacts.cfc?method=getContacts&returnformat=json",{"alpha":item}, function(res,code){
if(res.ROWCOUNT > 0){
开发者_如何转开发 for(var i=0; i<res.ROWCOUNT; i++) {
s += "<h3 class='postTitle'>" + res.DATA.CONTACTFIRSTNAME[i] res.DATA.CONTACTLASTNAME[i] + "</h3>"
+ "<p class='postDesc'>" + res.DATA.CONTACTEMAIL[i] + "</p>"
+ "<p class='postDesc'>" + res.DATA.CONTACTMOBILE[i] + "</p> <br class='clr' />"
};
s += "";
}
else {
var s = "Sorry, nothing matched your search.";
}
$("#results").html(s);
},"json");
})
});
and I'm getting the ; missing before statement message in relation to the line:
s += "<h3 class='postTitle'>...res.DATA.CONTACTLASTNAME[i] + "</h3>"
according to firebug.
I'm sure it's something obvious - hopefully your eyes will spot it where mine have failed!
Aren't you missing a +
sign between these two in that line?
res.DATA.CONTACTFIRSTNAME[i] res.DATA.CONTACTLASTNAME[i]
精彩评论