I want to split response text in ajax and display in two places in php using document.getElementById
this is my js
Code:
function approve(e) {
var req = getXMLHTTP();
if (req) {
req.onreadystatechange = function() {
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
var resp = req.responseText;
document.getElementById("get"+e).innerHTML=req.responseText;
<!--document.getElementById("status").innerHTML=;-->
} else {
alert("There was a problem while using XMLHTTP:\n" + req.statusText);
}
}
}
req.open("GET", "approve.php?stu="+e, true);
req.send(null);
}
}
Put a delineater mark in the returning text like ~ between the two messages.
Set a variable equal to the req.responseText; and then split the string at the ~
Use innerHTML to post both sections of the string to where you want.