Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Error al usar setRequestHeader para enviar datos por POST

Estas en el tema de Error al usar setRequestHeader para enviar datos por POST en el foro de Frameworks JS en Foros del Web. Holas Necesito enviar variables por post a una pagina asp ya ke son muchos, averiguando encontre ke hay ke poner esto: Código PHP: xmlHttp . ...
  #1 (permalink)  
Antiguo 25/09/2006, 16:06
Avatar de Rocket  
Fecha de Ingreso: diciembre-2001
Ubicación: Santiago, Chile
Mensajes: 272
Antigüedad: 22 años, 4 meses
Puntos: 4
Exclamación Error al usar setRequestHeader para enviar datos por POST

Holas
Necesito enviar variables por post a una pagina asp ya ke son muchos, averiguando encontre ke hay ke poner esto:

Código PHP:
xmlHttp.setRequestHeader('Content-Type''application/x-www-form-urlencoded'); 
y enviar las variables en el metodo send pero me aparece un error en la linea donde esta el setRequestHeader:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.setRequestHeader]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/web/contactoRutinas.js :: ingContacto_htm :: line 36" data: no]

eso me aparece en firefox y en IE tampoco funciona.

ya no se ke hacer, segn los ejemplos ke he visto en otro sitios y este lo estoy haciendo bien.

Alguien sabe ke pueda ser?
  #2 (permalink)  
Antiguo 25/09/2006, 23:55
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
que tal, asi lo tengo yo y me funciona exelentemente

Código PHP:
xmlHttp.open("POST""proceso.ext"true);
.
.
//aqui el resto del ajax....
.
.
xmlHttp.setRequestHeader("Content-Type""application/x-www-form-urlencoded");
_SendV "&variable1=contenido&variableN=contenido"
xmlHttp.send(_SendV); 
recuerda q cuando es POST las variables van en el send y en el open solo el archivo.
cuando es GET en el send va NULL y en el open va el archivo concatenado con las variables (?)


saludos
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
  #3 (permalink)  
Antiguo 26/09/2006, 07:26
Avatar de Rocket  
Fecha de Ingreso: diciembre-2001
Ubicación: Santiago, Chile
Mensajes: 272
Antigüedad: 22 años, 4 meses
Puntos: 4
gracias, funciono de pelos :P

lo ke tenia malo es el orden, tenia el xmlHttp.setRequestHeader antes del xmlHttp.open

gracias
  #4 (permalink)  
Antiguo 27/09/2006, 07:46
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
cool me alegro
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 17:12.