Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ajax ¶ÁÈ¡ .csv Îļþ

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>JavaScript Sample</title>
<link rel="stylesheet" type="text/css" href="main.css" media="all">
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<h1>CSVÐÎʽ¤Î¥Çー¥¿¤ò読¤ß込¤ß±íʾ¤¹¤ë</h1>
<div id="tableData">¥Çー¥¿¤ò読¤ß込¤ßÖÐ....</div>
</body>
</html>
window.onload = function(){
var msec = (new Date()).getTime();
new Ajax.Request("data.csv", {
method: "get",
parameters: "cache="+msec,
onSuccess:function(httpObj){
var text = httpObj.responseText;
var LF = String.fromCharCode(10);
var tabText = text.split(LF);
var tbl = "<table border='1'>";
for (var i=0; i<tabText.length; i++){
var cText = tabText[i].split(",");
tbl += "<tr>";
for (var j=0; j<cText.length; j++){
tbl += "<td>"+cText[j]+"</td>";
}
tbl +="</tr>";
}
tbl += "</table>";
$("tableData").innerHTML = tbl;
},
onFailure:function(httpObj){
$("tableData").innerHTML = "¥¨¥éー¤Ç読¤ß込¤á¤Þ¤»¤ó¤Ç¤·¤¿";
}
});
}


Ïà¹ØÎĵµ£º

¹ØÓÚ³¹µ×½â¾öAjaxÒì²½µ÷ÓÃʱ³öÏÖÖÐÎÄÂÒÂëµÄÎÊÌâ

½ñÌì°ïͬʽâ¾öÁËjsÒì²½µ÷ÓÃʱ³öÏÖÁËÖÐÎÄÂÒÂëµÄÎÊÌ⣬¾ßÌå½â¾ö°ì·¨ÈçÏ£º
1£©Ê×ÏÈÈ·ÈÏjsÊÇ·ñûÓжԺǫ́´«Êä¹ýÀ´µÄÖÐÎĽøÐнâÂë¡£
   °´ÕÕÍøÂçÉÏдµÄ·½·¨Í¨¹ýjs¶ÔresponseµÄ¶ÁÈ¡³öÀ´Êý¾Ý½øÐжà´Î²âÊÔ£¬·¢ÏÖÈÔÈ»²»Äܽâ¾ö£¬Ï¸Ïë²»Ò»¶¨ÊÇ´Ë´¦ÎÊÌâ¡£¸Ä»»ÆäËû°ì·¨½â¾ö¡£
2£©Èç¹û½âÂë½â¾ö²»ÁË£¬ÔÙ¿´ÊÇ·ñÊÇÒòÎªÍø ......

ajax´´½¨¶ÔÏó

function createXMLHttpRequest(){     
if(window.ActiveXObject){     
        http = new ActiveXObject("Microsoft.XMLHTTP");     
        }else if(window.XMLHttpRequest){     
& ......

IDE ȱÉÙ»ù´¡ÄÜÁ¦¼¯µ÷Óÿ⣬ÕâÊÇÒ»¸ö¼òµ¥µÄAjaxµ÷Óá£

var jsonObj;
var xmlhttp = null;
function callAsync(url, callbackSuccess)
{
 xmlhttp = new Ajax();
 xmlhttp.open("GET", url, true);
 xmlhttp.onreadystatechange=function()
 {
  // readyState = 4 ; "complete"
  if (xmlhttp.readyState==4)
  { ......

AjaxÓëWCF½»»¥ WCFÖ®ÃÀ


ÉÏÃæÒ»Æª²©ÎÄ<<Ajax·ÃÎÊXml Web ServiceµÄ°²È«ÎÊÌâÒÔ¼°½â¾ö·½°¸>>ÖÐ̸¼°xml web serviceÓëwcfÐÂÀϼܹ¹¶ÔÓÚajax°²È«ÐÔµÄÎÊÌâ,µÃ³öÁ˽áÂÛ,µ«Ã»ÓоßÌåÑéÖ¤,±¾ÎÄÕýÊÇΪÁËÑéÖ¤ÉÏÎÄÖйØÓÚмܹ¹MEX½áµãÓëÒµÎñÖÕ½áµã·ÖÀë¸üÓÐÀûÓÚ·þÎñ°²È«µÄ½áÂÛ,²¢ÉÔ´ø×޲ÊöÈçºÎÔÚvs2008ÖÐÓÃajaxÓëwcf½øÐн»»¥.
µÚÒ»²½: ÔÚvs2008ÖÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ