asp.net ajax post XML object throws 500 error resolution (client string vs. Xml object)

Source: Internet
Author: User

Ajax is all called "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML), a Web development technology that creates interactive Web applications.

Where asynchronous represents Asynchrony,

In addition, JavaScript and XML are nouns.

Where JavaScript is used as a client script

Ajax's main idea is to request server scripts asynchronously (synchronously) through XMLHttpRequest objects. The server returns to the client via Response.Write () after receiving the request.

var xmlHttp; To be defined as global

Create an XML request

function Createxmlhttprequest () {

try {xmlHttp = new ActiveXObject ("Msxml2.xmlhttp");       The catch (_e) {try {xmlHttp = new ActiveXObject ("Microsoft.XMLHTTP"); catch (_e) {}} if (!xmlhttp && typeof xmlhttprequest!= ' undefined ') {try {xmlHttp = new     XMLHttpRequest ();     catch (e) {xmlHttp = false; }     }}

Client through Xmlhttp.responsetext

or Xmlhttp.respnsexml

To get the value returned by the server side. So the result of the server-side return is a normal string. Another is the format of the XML text string in this way not to speak (online search a large)

This main introduction returns XML:

one point to declare: whether XML or plain text is routed as a string!!!!!! but it is necessary to deserialize these formatted XML characters when receiving at both ends (converting strings to XML objects)

A concrete example is given below: The XMLHttpRequest object has been declared

var obj = null; function Initxdom (xmlText) {if (typeof (Domparser)!= "undefined") {//Gecko, Mozil                LA, Firefox var parser = new Domparser ();              obj = parser.parsefromstring (XmlText, "text/xml"); }</

Related Article

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.