Hola, tengo dos páginas:
en index.php este formulario:
Código HTML:
Ver original<form id="formu" action="#"> <input id="domain" type="text" name="whois" class="input"> <input type="submit" value="buscar" />
cuyo submit es procesado por este script:
Código Javascript
:
Ver original$(function(){
$("#formu").submit(function(event){
event.preventDefault();
$.post("procesa_index.php", $("#formu").serialize(), function(data){
console.log(data.domain); //acá el problema
});
});
});
en procesa_index.php:
Código PHP:
Ver original/* arriba trabajo con una clase y finalmente los valores los guardo en un array al que luego lo paso a formato json y lo imprimo*/
"domain" => $domain,
"result" => $result,
"server" => $server,
"debug" => $debug,
"errors" => $errors,
"output" => $output
);
lo que genera por ejemplo el siguiente json:
Código Javascript
:
Ver original{
"domain":"ejemplo.com",
"result":"registered",
"server":"whois.verisign-grs.com",
"debug":"Used trigger: 'Domain Name:'",
"errors":"",
"output":"\nWhois Server Version 2.0\n\nDomain names in the .com and .net domains can now be registered\nwith many different competing registrars. Go to http:\/\/www.internic.net\nfor detailed information.\n\n Domain Name: EJEMPLO.COM\n Registrar: FABULOUS.COM PTY LTD.\n Whois Server: whois.fabulous.com\n Referral URL: http:\/\/www.fabulous.com\n Name Server: NS1.FABULOUS.COM\n Name Server: NS2.FABULOUS.COM\n Status: clientDeleteProhibited\n Status: clientTransferProhibited\n Updated Date: 10-dec-2010\n Creation Date: 07-jun-2001\n Expiration Date: 07-jun-2012\n\n>>> Last update of whois database: Wed, 01 Feb 2012 18:50:11 UTC <<<\n\nNOTICE: The expiration date displayed in this record is the date the \nregistrar's sponsorship of the domain name registration in the registry is \ncurrently set to expire. This date does not necessarily reflect the expiration \ndate of the domain name registrant's agreement with the sponsoring \nregistrar. Users may consult the sponsoring registrar's Whois database to \nview the registrar's reported date of expiration for this registration.\n\nTERMS OF USE: You are not authorized to access or query our Whois \ndatabase through the use of electronic processes that are high-volume and \nautomated except as reasonably necessary to register domain names or \nmodify existing registrations; the Data in VeriSign Global Registry \nServices' ("VeriSign") Whois database is provided by VeriSign for \ninformation purposes only, and to assist persons in obtaining information \nabout or related to a domain name registration record. VeriSign does not \nguarantee its accuracy. By submitting a Whois query, you agree to abide \nby the following terms of use: You agree that you may use this Data only \nfor lawful purposes and that under no circumstances will you use this Data \nto: (1) allow, enable, or otherwise support the transmission of mass \nunsolicited, commercial advertising or solicitations via e-mail, telephone, \nor facsimile; or (2) enable high volume, automated, electronic processes \nthat apply to VeriSign (or its computer systems). The compilation, \nrepackaging, dissemination or other use of this Data is expressly \nprohibited without the prior written consent of VeriSign. You agree not to \nuse electronic processes that are automated and high-volume to access or \nquery the Whois database except as reasonably necessary to register \ndomain names or modify existing registrations. VeriSign reserves the right \nto restrict your access to the Whois database in its sole discretion to ensure \noperational stability. VeriSign may restrict or terminate your access to the \nWhois database for failure to abide by these terms of use. VeriSign \nreserves the right to modify these terms at any time. \n\nThe Registry database contains ONLY .COM, .NET, .EDU domains and\nRegistrars."
}
El problema lo tengo en la línea nº 5 del script jquery (arriba) donde hago un "console.log()" y paso como parámetro data.domain.
En lugar de obtener la salida "
ejemplo.com" obtengo "
undefined"
¿estoy accediendo mal al objeto?
Desde ya muchas gracias por su respuesta.