All pastes #260513 Raw Edit

Divers

public text v1 · immutable
#260513 ·published 2006-11-28 13:29 UTC
rendered paste body
function populate_dest(f) {
  var l1    = f.elements["id_type_rdv"];
  var l2    = f.elements["id_dest"];
  var index = l1.selectedIndex;
  if(index < 1)
    l2.options.length = 0;
  else {
    var xhr_object = null;

    if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
    else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
    else { // XMLHttpRequest non supporté par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return;
    }

    switch(l1.value) {
      case 1: xhr_object.open("POST", "phpToJs/tasks.inc.php", true); break;
      case 2: xhr_object.open("POST", "phpToJs/agences.inc.php", true); break;
      case 3: xhr_object.open("POST", "phpToJs/particuliers.inc.php", true); break;
      case 4: xhr_object.open("POST", "phpToJs/prospects.inc.php", true); break;
      case 5: xhr_object.open("POST", "phpToJs/users.inc.php", true); break;
      case 6: xhr_object.open("POST", "phpToJs/fours.inc.php", true); break;
      case 7: xhr_object.open("POST", "phpToJs/societes.inc.php", true); break;
    }


    xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4)
        eval(xhr_object.responseText);
    }

    xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    var data = "id_type_rdv="+escape(l1.options[index].value)+"&form="+f.name+"&select=id_dest";
    xhr_object.send(data);
  }
}

// Error

Erreur : uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.setRequestHeader]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: http://www.wansys.com/planning/index2.php?content=11&date_rdv=2006-11-28&id_type_exec=2&id_exec=2&id_journee=3 :: populate_dest :: line 198"  data: no]