javascript - How to use req.responseText, in Ajax to return only the content inside a div of a page -
i using xmlhttp request in ajax, have problem. want use document.getelementbyid('partid').innerhtml=request.responsetext
in way return content inside div
called'cars'
of page export.php. when use above return content of page export.php. there way make line of code return content inside div? trying use like:
document.getelementbyid('partid').innerhtml=request.responsetext.getelementbyid('cars').
, not function.
please,help me. have spend hours searching have not find this..please help.thanks in advance
when responsetext
comes back, -- name suggests -- text.
before can access html, have turn html.
this typed off cuff, like:
var tempdiv = document.createelement("div"); tmpdiv.innerhtml = request.responsetext; var wanteddiv = tmpdiv.queryselector('[id="cars"]'); // might want empty out 'partid' first document.getelementbyid('partid').appendchild(wanteddiv);
Comments
Post a Comment