Do not refresh the page - refresh data

xiaoxiao2021-03-06  105

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 (" Xie Lemon ", "http://www.wrclub.net/viva.asp";) // Execute the function if (CAT == false) {Alert ("Sorry. The handler returns false. Data processing has failed ...")} else {if (eval (cat)) {Alert ("OK. Data has been sent success. Cost !!!!!!")} else {Alert ("Sorry. The handler returns False. Data processing has failed .........) }} ========================================== viva.asp === =============================================== on Error Resume Nextdim Bobodim Momoset Bobo = Server.createObject ("Microsoft.xmldom") Bobo.async = falsebobo.load requestif Bobo.Parseerror.ErrorCode <> 0 ThenResponse.write ("program processing result> false " ) Elseset MOMO = Bobo.documentelementif Momo.childNodes.Item (0) .text = "Xie Lemon" ThenResponse.write (" True )) Elseresponse.write (" False ") end ifnd ifset bobo = Nothing

===================================================== Script language = "JavaScript">

转载请注明原文地址:https://www.9cbs.com/read-103029.html

New Post(0)