Below is just part of my ajax code, while my 'resp' variable returns the whole response from test.php. Is there a way that I can simply return a responseText between the specified tag? i.e. just return the text html answer inside test.php div id = "xyz"?
var loc="test.php?myinput=apple";
ajax.onreadystatechange=function() {
if (ajax.readyState==4 && ajax.status == 200) {
var resp = ajax.responseText;
}
}
ajax.open("GET",loc,true);
ajax.send(null);
source
share