Board Logo

httprequest
cpi - 6/27/2006 at 08:37 AM

Quote:
<html>
<head>
<title>Untitled</title>
<link rel="stylesheet" href="../css/table.css">
<script language="JavaScript" src="../js/table.js"></script>
<script language="JavaScript" src="../js/template.js"></script>
<script language="JavaScript" src="../js/content.js"></script>
</head>
<script type="text/javascript">
var xmlhttp;

function loadXMLDoc(url,parm)
{
alert('antes de request');
self.status = "AJAX Enviando: " + url + " -.- " + parm
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest()
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("POST",url,true)
xmlhttp.send(parm)
}
// code for IE
else if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp)
{
url=url+ 'E';
xmlhttp.onreadystatechange=xmlhttpChange
xmlhttp.open("POST",url,true)
xmlhttp.send(parm)
}
}
}

function xmlhttpChange()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
self.status = "AJAX Recibe: " + xmlhttp.responseText
d=document.getElementById("query");
datosTabla= xmlhttp.responseText;
}
else
{
self.status = "AJAX error."
alert("Error al recibir datos XML Ajax")
}
}
}

function SendAjaxData()
{
var wprm = "cwzpgm=QUERY2&cwztrn=%cw-cwztrn0%&demoname=David"
+ "&r4novale=novale"
loadXMLDoc("R4AJAX",wprm);
}

function cambiar(){
tabla.changeCont('TABLE_CONTENT',3);
}
</script>


<body>
<input type="button" name="req" value="req" title="Enviar Ajax"
onclick=" cambiar(); SendAjaxData();" />
<input type="button" name="cambiar" value="cambiar" onClick="cambiar()" />
<div id="query" style="border-width:thin; border-color:silver; border-style:groove;">
<SCRIPT LANGUAGE="JavaScript">
var tabla = new TTable(TABLE_CAPT, TABLE_CONTENT, TABLE_LOOK);
</SCRIPT>
</div>
</body>
</html>


Look like
Quote:
<input type="button" name="req" value="req" title="Enviar Ajax"
onclick=" cambiar(); SendAjaxData();" />


run OK, but

Quote:
<input type="button" name="req" value="req" title="Enviar Ajax"
onclick=" SendAjaxData(); cambiar(); " />


dont run. Error: TTPi is not defined in table.js (line 9).

MyTTP.changeCont dont works if xmlhttprequest is running before!!

Please help.


Softcomplex: http://www.softcomplex.com/
Back to forum: http://www.softcomplex.com/forum/