Originariamente inviato da br1
In quello che posti non c'e' nulla a cui attribuire la visibilita' della select, cerca altrove negli altri script che non posti.
Se poi con ajax ricevi l'intera select da iniettare nel div, e' ovvio che finche' non esegui la richiesta non vedrai nulla...
ciao
grazie per la risposta:
la select si crea via php e viene inserita nel div come dici tu .. altro codice js non c'è n'è tranne la parte ajax ... dici che è quello in problema?
favorisco il codice magari che scappandoti l'occhio vedi qualcosa che possa fare ciò che mi serve... ci sto smanettando da 3 giorni praticamente senza ottenere risultato... ci sarà una variabile o un qualcosa che 'avverta' in sistema che la seconda select va visualizzata?
codice:
// JavaScript Document
// File JScript
function sajax(url, onload, parameters, onerror)
{
parameters = (parameters == undefined)? "" : parameters;
//creazione oggetto per richiesta web
var objHTTP = getXMLHttp();
objHTTP.open("post", url, true);
objHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
objHTTP.setRequestHeader('Content-length',parameters.length);
objHTTP.setRequestHeader('Connection', 'close');
objHTTP.onreadystatechange = function()
{
if (objHTTP.readyState == 4)
{
if (objHTTP.status == 200 || objHTTP.status == 0)
{
this.request = objHTTP;
if(onload) onload.call(this);
}
else {if(onerror && typeof(onerror) == "function") {onerror(defaultError); return;}else {defaultError(); return;}}
}
};
objHTTP.send(parameters);
function getXMLHttp()
{
var xmlhttp = null;
if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest(); // Gecko (Firefox, Moz), KHTML (Konqueror, Safari), Opera, Internet Explorer 7
}
else if(window.ActiveXObject)
{
try
{
xmlhttp = new ActiveXObject("MSXML2.XMLHTTP"); // Internet Explorer 6
}
catch(e)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 4,5
}
}
else
{
xmlhttp = null;
}
return xmlhttp;
};
function defaultError()
{
alert("ERRORE NELLA TRASMISSIONE DATI!");
};
}
//al posto di mettere document.getElementById("div1"), mettere $("div1")
//da prototype.js
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}