Click to See Complete Forum and Search --> : [RESOLVED] JS Error via Ajax script


Kudose
12-13-2006, 09:29 PM
Hello all. I am using the following code in a part of my script. It is supposed to take reponseText, which is an integer, and remove that div from a set of divs.

The parent div is books and the child is the ID of the book, an integer.

Here is the JS code:

var toRemove = document.getElementById('books');
var toDelete = request.responseText;
toRemove.removeChild(toRemove.toDelete);

Is produces this error:

Error: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.removeChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://www.asd.us/asd/asd.php :: showResult :: line 30" data: no]
Source File: http://www.asd.us/asd/asd.php
Line: 30

Any help would be appreciated.

Kudose
12-13-2006, 11:21 PM
Resolved:

var toRemove = document.getElementById('books');
var toDelete = document.getElementById(request.responseText);
toRemove.removeChild(toDelete);