Jump to content


Photo

Carrega Dados Salvos


  • Faça o login para participar
1 reply to this topic

#1 luckynho

luckynho

    12 Horas

  • Usuários
  • 120 posts
  • Sexo:Não informado
  • Localidade:São Paulo

Posted 12/07/2007, 10:58

Ae galera.. beleza ?
Bom, na hora do cadastro que eu fiz, estou utilizando 2 combos. Se vc escolhe 1, ele carrega opcoes no de baixo.
Até ai, belezinha, funciona perfeito.
Meu problema é o seguinte, quando eu vou editar essas informações, uma hora ele carrega, outra hora nao carrega. Tanto no IE, tanto no Firefox.

Ja aconteceu com alguem isso ? Trabalho com CGI e mysql, mas acredito que nao tenha nada haver... é questao de carregar os dados.


Vejam:

if (!xmlhttp2 && typeof XMLHttpRequest!='undefined') {
xmlhttp2 = new XMLHttpRequest();
}


function update_cnpj(obj_razao,obj_cnpj){
if (document.requisitionform.custom51.value != "") {
obj_cnpj.length = 0;
obj_cnpj.options[0] = new Option('carregando...','');
fantasia='';
for (i=0 ; i < obj_razao.length ; i++){
if (obj_razao[i].selected == true) {
if (obj_razao[i].value != "") {
fantasia+=obj_razao[i].value+',';
}
}
}
num=fantasia.length;
fantasia=fantasia.substring(0,num-1);
// get the contents off-screen
xmlhttp2.open('GET','/cgi-bin/shared/ajax_razao_cnpj.cgi?cus='+fantasia,true);
xmlhttp2.onreadystatechange = function() {
if(xmlhttp2.readyState == 4){
options = xmlhttp2.responseText.split("\n");
// clean and insert values from CGI
obj_cnpj.length = 0;
obj_cnpj[0] = new Option('--','',false,false);
for(x in options){
if(options[x] != ''){
variaveltemp = "~%custom48%~";
var lista = variaveltemp.split(",");
contador = 0;
for (y in lista) {
if (options[x].substr(0,4) == lista[y]) {
obj_cnpj.options[obj_cnpj.options.length] = new Option(options[x].substr(5,options[x].length),options[x].substr(0,4),false,true);
} else {
contador++;
if (contador == lista.length) {
obj_cnpj.options[obj_cnpj.options.length] = new Option(options[x].substr(5,options[x].length),options[x].substr(0,4),false,false);
}
}
}
}
}
}
}
xmlhttp2.send(null);
}
}


Edição feita por: luckynho, 12/07/2007, 11:04.


#2 silici0

silici0

    ?

  • Usuários
  • 902 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP
  • Interesses:PHP, MySQL, XHTML, CSS, AJAX, JavaScript, Objective-C, Python, Games ... #geek

Posted 13/07/2007, 09:19

Bom, primeiramente saiba que AJAX = requisição e essa requisição não tem tempo de resposta... talvez seu servidor esteja 'lerdo'.

Abraços
Procurando freelancer
***********************************************
Bachelor of Technology in Technology of Information, with great knowledge in Windows operating systems and Unix-Like (BSD, Ubuntu and Slackware), languages (PHP, JavaScript and MySQL), semantic (DHTML, Tableless, Ajax, MVC, OO) and analysis (manages projects based on PMI).
Developer in PHP, JAVA, Python, Objective-c MySQL, DHTML, CSS, JAVASCRIPT, JQUERY, JSON, SMARTY, MDB2, DOCTRINE, CAKEPHP. Linux desktop for work and MacOS. E-commerces, CRM and bussiness strategys
Love-me and be FREE use UniCes-Like .




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq