我不知道为什么这不起作用(不能调用 SendValues 方法)。没有错误引发。谁能帮我 ?非常感谢!
html页面如下所示:
<script language="javascript" type="text/javascript">
$(function () {
$("#Button1").click(function () {
$.ajax({
type: "POST",
url: "WebForm1.aspx/SendValues",
data: { 'Code': '1026' },
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (json) {
alert(json.d);
},
failure: function () {
alert("Sorry,there is a error!");
}
});
});
});
</script>
c# 代码类似:
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public static string SendValues(string Code)
{
string contects = string.Empty;
return contects;
}
}