I'm working on an ecommerce application for school and am trying to get a simple AJAX function to query database and return some images to a web page. So far, I've managed to successfully do all except for the final step: I can't manage to get the returned data to appear as thumb images in the document.
I am 100% certain that the returned data is:
<a href="?id=1"><img src="images/thumbs/1.1.png" class="thumbox" /></a>;
<a href="?id=4"><img src="images/thumbs/2.1.png" class="thumbox" /></a>;
The callback function I'm using is:
CODEfunction callback() {
if (request.readyState==4) {
if (request.status == 200) {
var id = document.getElementById('categoryThumbBox');
id.appendChild(request.responseText);
}
}
}
This produces the following error:
[Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://localhost:8084/kramekznamek/js/javascript.js :: callback :: line 22" data: no]
I'm fairly sure the problem lies in using the right method with 'id'.
Also, interestingly enough, if I type in "document.write(request.responseText)" as a test, I see exactly what I'm wanting: two thumb images.
If anyone has any suggestions, I'd be really grateful
thanks,
larry
