Tutorial for ajax1-php (27), ajax1php27_PHP

Source: Internet
Author: User
Ajax1-php (27), ajax1php2. Ajax1-php (27), ajax1php2 A Brief Introduction to web program working principle diagram: the traditional web program working principle diagram: 2, the core object XMLHttpRequest I, create an object in a different browser ajax1-php (27), ajax1php2

1 Introduction

Working Principle of web programs:

Working Principle of traditional web programs:

II. Core objects

XMLHttpRequest

1. create an object

In different browsers, the method for creating ajax objects is slightly different.

IE:

New ActiveXObject ("Microsoft. XMLHTTP ")

III. Ajax object attributes and methods:

1. related methods:

L open (method, url)

Initialize ajax objects

Method: request method post, get

Url: Request resource address

L setRequestHeader (header, value)

Set request header information

Header: Header information

Value: Value

L send (content)

Send request

Content: The passed parameter must be placed here only when the post request is made.

2. related attributes:

L readyState

The status code of the Ajax object, which changes at any time

0: indicates that the object has been created but not initialized.

1: indicates that the object has been initialized but not sent

2: The send method has been called for the request.

3: receiving data (receiving part)

4: Received

L onreadystatechange

The callback function triggered when the status code of the ajax object changes.

L status

Http response status code

L statusText

Http response text

L responseText

Http response content text

L responseXML

Xml data of http response content

There are three main ways to transmit Ajax object data:

Text: responseText

Xml: reponseXML

Json: responseText

Http://www.bkjia.com/PHPjc/998221.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/998221.htmlTechArticleajax1-php (27), ajax1php2 A Brief Introduction to web program working principle diagram: the traditional web program working principle diagram: 2, the core object XMLHttpRequest I, create objects in different browsers...

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.