IBM has just released a guide to Ajax transmission, which describes how to use XMLHTTP, script tags, and frames or iframes.
Original address https://www6.software.ibm.com/developerworks/education/x-ajaxtrans/
You need to register before downloading the PDF file and source code.
For these three modes, the author most appreciates the script tags, and its loading process is like this.
VaR urlstoload = [];
Function processrequests ()
{
For (var u in urlstoload)
{
VaR sobj = Document. createelement ('script ');
Sobj. src = urlstoload [u];
Document. Body. appendchild (sobj );
}
}
Function loaddoc (URL)
{
Urlstoload. Push (URL );
}
If (window. addeventlistener)
Window. addeventlistener ('load', processrequests, 0 );
Else
Window. attachevent ('onload', processrequests );
VaR url = Window. Location. tostring ();
Url = URL. Replace (///.*? $/, "Sources/jsadd. php ");
Loaddoc (URL );
This article also mentions three types of Ajax data transmission: Text, HTML, XML, JSON
I personally think that both the transmission mode and the data transmission mode have their own advantages and can only be selected based on project requirements.
For the data format, HTML can be used to make full use of the template function of the server script language. XML can be used in areas that require standard data sharing, such as stock information or weather information. JSON can be used in some client controls, such as the case that listview requires a large amount of data binding.