JScript code:
var xmlhttp;
if (window.ActiveXObject){xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
else if (window.XMLHttpRequest) {xmlhttp = new XMLHttpRequest();alert("1");}
alert(xmlhttp);
²âÊÔxmlhttp¶ÔÏóÊÇ´´½¨µÄwindow.XMLHttpRequest£¬µ«ÊǾÍÊDz»Ö´ÐÐÏÂÃæµÄ xmlHttp.on ......
´ó¼ÒÈ¡¸öÀý×Ó°É
ʹÓÃjsonÊý¾Ý¸ñʽ
²»ÄÜÕâÑùµÄ£¬phpҪת»¯Îª xml »òÕß json £¬Ç°Ì¨Óà jsÀ´½âÊÍ
ÓÐʲô²å¼þûÓÐÄØ£¿
ÒÔÇ°ÔÚJSPÀïÃæÓÃjsonrpc,дÂß¼º¯Êý¿ÉÒÔÖ±½Ó·µ»ØÊý×é
PHP code:
$arRet = array( "error" => false, array( 'user', 'pass' ) );
echo json_encode( $arRet );
ajax·µ»ØÊý¾Ý ......
<script language="javascript">
//jbº¯Êý»á¸ù¾Ý²»Í¬µÄä¯ÀÀÆ÷³õʼ»¯¸öxmlhttp¶ÔÏó
function jb()
{
var A=null;
try
{
A=new Act ......
ÎÒ×°ÉÏ΢ÈíµÄAJAX°²×°°üÖ®ºó£¬´ò¿ªÖ®Ç°µÄÏîÄ¿£¬¼ÓÉϲ»ScriptManagerÄØ£¿
¶øÇÒ£¬ÔÚ×óÔòµÄ¹¤¾ßÏäÀïҲûÓÐAjax¹¤¾ßÑ¡Ï¡£
µ«ÊÇÈç¹ûÎÒн¨Ò»¸öÏîÄ¿µÄ»°£¬×Ô¶¯Éú³ÉµÄDefaultÒ³ÃæÖÐÓÐScriptManager,×óÔò´°Ì廹ÊÇûÓÐAjaxµÄ¹¤¾ßÏä¡£
ÄǾÍÓ¦¸ÃÊÇÄã°²×°µÄÎÊÌ⣬ȥMSµÄÕ¾µãÉÏÏÂÔØÕýÈ·µÄ°²×°°ü¡£
ÖØÐÂÏÂÔØÒ»¸ö°É£¬°æ±¾²»¶Ô
......
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter"/>
<sectionGroup name="system.web.extensions" ......
ÇëÎÊÔÚScriptManagerÖУ¬ÓÃÕâ¸öÒýÈëJS½Å±¾£º
<asp:ScriptReference Path="MyPath/MyCustomScript.js" />
ºÍÖ±½ÓÒýÈë½Å±¾ÓÐʲô²»Í¬ÄØ£¿
ÏñÕâÑù£º
<script src="MyPath/MyCustomScript.js" type="text/javascript"></script>
ÇëÖ¸½Ì£ ......