JavaScript Ajax get information function code _AJAX related

Source: Internet
Author: User
The client side code is as follows:
Copy Code code as follows:

<script language= "JavaScript" ><!--
function Getit () {
if (document.getElementById ("url"). value== "") {
Alert ("Enter url!");
return false;
if (document.getElementById ("Count"). value== "") {
Alert ("Enter count!");
return false;
if (document.getElementById ("num"). value== "") {
Alert ("Enter num!");
return false;
if (document.getElementById ("End"). value== "") {
Alert ("Enter end!");
return false;
var url=document.getelementbyid ("url"). Value;
var Count=document.getelementbyid ("Count"). Value;
var num=document.getelementbyid ("num"). Value;
var End=document.getelementbyid ("End"). Value;
Sendcall (Url,count,num,end);
function Sendcall (url,count,num,end) {
if (parseint (num) >=parseint (end)) {return false;}
var nurl=url+ "count=" +count+ "&num=" +num;
alert (Nurl); (Nurl);
var xmlHttp;
if (window. ActiveXObject) {
XmlHttp = new ActiveXObject ("Microsoft.XMLHTTP");
else if (window. XMLHttpRequest) {
XmlHttp = new XMLHttpRequest ();
Resolving cross-domain problems in FF
try{ ("Universalbrowserread");
catch (e) {
Alert ("Permission Universalbrowserread denied.");

Xmlhttp.onreadystatechange = function () {
if (xmlhttp.readystate = = 4 && xmlhttp.status ==200) {
var str = Xmlhttp.responsetext;
var Msg=document.getelementbyid ("getmsg");
if (Str.match (/thereisnothing/)) {
msg.innerhtml = "Data has been transmitted!" "
Msg.innerhtml =str;
Write (Str,count,num);
var next=parseint (num) +parseint (count);
Sendcall (Url,count,next,end);
} (' POST ', Nurl, true);
Xmlhttp.setrequestheader ("Content-type", "Text/xml");
Xmlhttp.setrequestheader ("CharSet", "Utf-8");
Xmlhttp.send (NULL);
function Write (str,count,num) {
var fso = new ActiveXObject ("Scripting.FileSystemObject");
var end = parseint (num) +parseint (count);
var name = "e:\\" +num+ "-" +end+ ". txt";
var a = fso. CreateTextFile (name, true);
A.writeline (str);
A.close ();
Alert ("I have generated a" +name+ "file in your e-packing directory!) ");
document.getElementById ("num"). Value=end;
var Msg=document.getelementbyid ("getmsg");
Msg.innerhtml= "I have generated a" +name+ "file in your e-packing directory! ";

Enter the setup then get the info:

<input id= "url" value= "" size= "M" >
<input Type=button value= "Start" onclick= "Javascript:getit ();" ><br><br>
<div id= "Getmsg" >

→how many once:<input name= "Count" id= "Count" type= "text" value= "1000" size= "/><br><br>"
→begin num: <input name= "num" id= "num" type= "text" value= "0" size= "/><br><br>"
→end num: <input name= "End" id= "End" type= "text" value= "" size= ""/><br><br>

Features can be improved, improve the prevention of network congestion caused by the failure to obtain information caused by the discontinuity, can be improved to achieve a lot of functions, such as the brush ticket ... Own play, I only provide ideas ~
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: 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.