Hi!
I have a problem with my ajax function.
The functions makes text within <p>text</p> reappear as an editable textarea if you press it.
And when you change it and press ok, it goes back, while sending information to another php site, which makes changes in a database (according to the <p [B]id=”what_to_change”
The problem is that somehow, I cant make it work with changing the text to more than 20 letters…
[CODE]var xmlHttp
// bör man lägga till document.getElementById(txt1) innan det andra??
window.onload=function() {
var qa = document.getElementById(‘txt1’).value;
var wa = document.getElementById(‘txt2’).value;
var ca = document.getElementById(‘txt3’).value;
var da = document.getElementById(‘txt4’).value;
}
// bör man lägga till txt1.qa?
function showUsera(qa, wa, ca, da)
{
//if (qa.length < 2)
//{
//document.getElementById(“txtHint”).innerHTML=”Skriv in minst 3 siffror/bokstäver”
//return
//}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert (“Browser does not support HTTP Request”)
return
}
var url=”geten.php”
url=url+”?q=”+qa+”&w=”+wa+”&c=”+ca+”&d=”+da
url=url+”&sid=”+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open(“GET”,url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState==”complete”)
{
document.getElementById(“txtHint”).innerHTML=xmlHttp.responseText
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject(“Msxml2.XMLHTTP”);
}
catch (e)
{
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
}
return xmlHttp;
}