AJAXµ÷ÓÃwebservice³ö´í
ÎÒÕÕ×ÅÍøÉÏ×öÁËÒ»¸ö³¬¼òµ¥µÄAJAXµ÷ÓÃWEBSERVICEµÄ·¶Àý,½á¹ûʧ°Ü,¸÷λ°ïæ¿´¿´Ê²Ã´ÔÒò.
²Ù×÷²½ÖèÈçÏÂ:Ìí¼ÓÒ»¸öwsDemo.asmxµÄÐÂÏî,²úÉú2¸öÎļþ(wsDemo.asmxºÍwsDemo.cs)
ÔÚwsDemo.csÎļþÖÐʵÏÖ´úÂëÈçÏÂC# code:
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
/// <summary>
/// wsDemo µÄժҪ˵Ã÷
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class wsDemo : System.Web.Services.WebService
{
public wsDemo()
{
}
[WebMethod]
public string Welcome(string u)
{
string strMsg = "»¶Ó[" + u + "]";
return strMsg;
}
}
ÔÚÒ³ÃæÎļþÖÐʵÏÖ´úÂë:
javascript²¿·ÖJScript code:
<script language =javascript type="text/javascript">
function OnbtOk_Click()
{
var userName = document.getElementById("iUserName").value;
var ws = wsDemo;
ws.Welecome(userName,ShowMsg);
return false;
}
function ShowMsg(result)
{
alert(result);
}
</script>
Ïà¹ØÎÊ´ð£º
ÔÚ¼ÒÑо¿ajax£¬¿´Á˱ðÈ˵ÄÒ»¸öÍøÉϹºÎïÉ̳ÇÏîÄ¿µÄÔ´´úÂ룬×Ô¼ºÒ²À´·Â±ðÈ˵Ķ«Î÷Á·Ï°Á·Ï°£¬Ã»Ïë³öÎÊÌâÁË£¡Ò»ÏµÄÕâЩ´úÂëÊÇÎÒ·ÂÕÕ±ðÈËдµÄ¡£ÎÒÊÇÏëÈÃ×¢²áµÄÈËÌîдÓû§Ãû£¬¹â±êÀ뿪Óû§ÃûºóÃæµÄÌîд¿Õ°×´¦ºóÁ¢¿ÌÀûÓÃaj ......
ajaxÔõôʵÏÖÐÂÔöÏÂÀÁбíÎÞˢС£ÀàËÆ
http://hi.baidu.com/comasp/blog/item/aa34e736bfc269320a55a9ad.html¡£
»¹ÓÐÍøÒ×163Blog£¬Ìí¼Óblogʱ£¬Èç¹ûдµÄÎÄÕÂûÓкÏÊʵķÖÀà¿ÉÑ¡£¬¿ÉÒÔµã»÷Ìí¼ÓеÄÎÄÕÂÀàÐÍ£¬È»ºóÌ ......
JScript code:
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
function ajaxTest() {
var starttime = document.getElementById(&q ......
jquery ajax µÄsuccess»Øµ÷º¯Êý²»Ö´ÐÐ
×Ô¼ºÍ¨¹ýfirebugµ÷ÊÔÁ˵ģ¬Í¨¹ýAJAXÒ²Äܵõ½Òì²½ÇëÇóµÄÊý¾Ý£¬µ«ÊǾÍÊDz»Ö´ÐÐsuccessº¯Êý¡£
ÍøÉÏÒ²ÕÒÁ˰ëÌ죬ºÜ¶àÒ²ÓÐÕâ¸öÎÊÌ⣬µ«ÊǶ¼Ã»Óнâ¾ö¡£
ÓÐûÓÐÓöµ½¹ýÕâÖ ......