In XMLHttpRequest, how does responseText obtain the content of a specified <div> instead of the entire HTML content?

Source: Internet
Author: User
Response ument. getElementById (reobj). innerHTMLhttp_request.responseText; now how to get the specified responseText in responseT XMLHttpRequest

Instead of the entire HTML content.
Http_request = new XMLHttpRequest;
....
Document. getElementById (reobj). innerHTML = http_request.responseText;

Now responseText returns the entire HTML. how can I have it return the content in my specified tag?

Note: The framework is useless for any template, but an xmlajax. js file is loaded in index. php. In xmlajax. js, the above code obtains the entire HTML code of index. php. How to get the content of the specified tag instead of the entire HTML code !!!




------ Solution --------------------
Didn't you bother yourself?
Document. getElementById (reobj). innerHTML = http_request.responseText;
Document. getElementById (reobj). innerHTML = document. getElementById (reobj). getElementById ('_ ajax'). innerHTML

------ Solution --------------------
In this case, why don't you use responseXML? Let index. php generate an xml file, and then use the javascrip DOM to read the content of the desired node!
------ Solution --------------------
Index. php

Is the requested file controllable? You can control the returned content.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.