ajax如何使用,页面如何调试
ajax是前后端交互的工具
ajax的名字就体现了这个意思
首先下载ajax
ajax下载为一个项目
在里面可以找到ajax.dll文件
我们把ajax文件引入到项目中
如图
然后我们cs文件中
注册ajax开始使用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace easyui._ajax
{
public partial class ajax_use :System.Web.UI.Page
{
/* protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(ajax_use));
}*/
public void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.GenerateMethodScripts(this);
}
[Ajax.AjaxMethod]
public string getString(string str)
{
string strResult = "The string is " + str;
return strResult;
}
}
}
具体注册有些错误
网上使用的是Ajax.Utility.RegisterTypeForAjax(typeof(ClassName));//ClassName是这个CS文件的类名
接下来配置web.conf
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
</httpHandlers>
</system.web>
ajax如何使用,页面如何调试
ajax是前后端交互的工具
ajax的名字就体现了这个意思
首先下载ajax
ajax下载为一个项目
在里面可以找到ajax.dll文件
我们把ajax文件引入到项目中
如图
然后我们cs文件中
注册ajax开始使用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace easyui._ajax
{
public partial class ajax_use :System.Web.UI.Page
{
/* protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(ajax_use));
}*/
public void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.GenerateMethodScripts(this);
}
[Ajax.AjaxMethod]
public string getString(string str)
{
string strResult = "The string is " + str;
return strResult;
}
}
}
具体注册有些错误
网上使用的是Ajax.Utility.RegisterTypeForAjax(typeof(ClassName));//ClassName是这个CS文件的类名
接下来配置web.conf
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
</httpHandlers>
</system.web>