I'm all hosed up...most of this is pretty new to me, so please forgive my terminology. I'm using scriptaculous for the DnD stuff. Using AJAX I'm returning a variable from the server. The variable can be verified using alert(variable), but when I pass the variable as an argument it isn't working...
phpScript.php-
<?php print $divID; ?>
function onDropEvent(draggable,droparea){
var url="phpScript.php";
var rand = Math.random(9999);
var pars = 'divID=' + draggable.id + '&rand=' + rand;
var myAjax = new Ajax.Request( url, {method: 'get',
parameters: pars, onComplete: showID} );
}
function showID(myAjax){
var newVar=String(myAjax.responseText);
alert(newVar); // <----alert shows expected divID
if (newVar == 'close') { // <----not evaluated
alert(newVar);
}
else {
toggle(newVar); // <----newVar=divID (should)
}
}
function toggle (elid) {
//var elid="divID"; //<-- works this way
var cdiv = document.getElementById(elid); //<-- doesn't work
var pdiv = cdiv.parentNode;
alert(cdiv.id +" "+ pdiv.id); //<-- empty without hardcode
}