Asp.net ajax post xml Object throw 500 Error solution (conversion of client strings and xml objects)

Source: Internet
Author: User

AJAX is called "Asynchronous JavaScript and XML" (Asynchronous JavaScript and XML). It is a Web page development technology used to create interactive web applications.

Asynchronous indicates Asynchronous,

In addition, both javascript and xml are nouns.

Javascript is used as the client script.

The main idea of ajax is to use the XMLHttpRequest object to asynchronously (synchronously) request the server script. After the server receives the request, it returns it to the client through response. write.

Var xmlHttp; // global

// Create an XML request

Function createXMLHttpRequest (){

Try {xmlHttp = new ActiveXObject ("Msxml2.XMLHTTP");} catch (_ e) {try {xmlHttp = new ActiveXObject ("Microsoft. XMLHTTP ");} catch (_ E) {}} if (! XmlHttp & typeof XMLHttpRequest! = ''Undefined') {try {xmlHttp = new XMLHttpRequest ();} catch (e) {xmlHttp = false ;}}}

The client uses xmlHttp. responseText

Or xmlHttp. respnseXML

To obtain the value returned by the server. Therefore, the server returns a common string and formatted xml text string)

Here we will mainly introduce the returned xml:

Declare one point: Both xml and plain text are transmitted as strings !!!!!! However, during receiving at both ends, the formatted xml characters must be deserialized (converting strings into xml objects)

The following is an example: the XMLHttpRequest object has been declared.

Var obj = null; function initXDom (xmlText) {if (typeof (DOMParser )! = "Undefined") {// Gecko, Mozilla, 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.