Do not refresh the page - refresh data
Author: Unknown from: World Resources Network collected Published: 2004-8-19 3:32:00 Super Simple / Convenient - - Do not refresh the new page - refresh data - behind-the-scenes black hand --- XMLHTTP --- Introduction / usage ------ ---------- is the simple JavaScript function Send (STR, URL) ---------------------- use XMLDOM and XMLHTTP objects. The benefits of this technology are: all JS control, convenient / simple, much better than RDS or Remote. (Prerequisite: server-side and clients must install IE5 or higher), in a post The brushless online information function is also useful. Interested friends can look at the ..function Send (STR, URL) // STR parameter is incoming XML data, you can also pass within other text data ./ / But this function returns to XML data after server-side processing, you can also modify the // URL parameter indicating the ASP file address you want to process {var http = new activxObject ("Microsoft.xmlhttp") // Establish XMLHTTP Object VAR Dom = New ActiveXObject ("Microsoft.xmLDom") // Establishing XMLDOM object http.open ("post", url, false) // The first parameter means, send data in "POST" mode. Can be large to 4MB You can also change to "get". Only 256kb // second parameters means that data transmission to which file processing // The third parameter means synchronous or asynchronous mode. True is asynchronous, false is synchronous http.send (STR) // Start sending data ........... Dudu .. Dom.async = false // Set to get data DOM.LOADXML (http.responsetext) // start getting The data returned after the server is processed. I have set it here to XML data, otherwise an error .// You can also modify it yourself. Make the return 2 binary or record set data ........... .................... i f (dom.parseerror.errorcode! =
0) // Check if it is acquired data error {delete (false)} else {var back = dom.documentelement.childnodes.item (0) .text // get returned XML data, I assume that the handler only returns a line XML data (one node) delete (http) delete (DOM) return (back) // function returns data ................... .... End}} var Cat = Send ("
===================================================== Script language = "JavaScript"> script>