日期:2014-05-17 浏览次数:20445 次
<a class="format">123</a><br />
<a class="format">456</a>
<script type="text/javascript">
$(".format").click(function(iFormat) {
$.ajax({
type: "post",
url: "test.aspx/chooseFormat",
data:{"str":iFormat},
datatype: "json",
contentType: "application/json; charset=utf-8",
success: function(data) {
alert(‘’);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(errorThrown);
}
});
});
</script>
[WebMethod]
public static void chooseFormat(string str)
{
string aaa = str;
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm15.aspx.cs" Inherits="Linq_Test.WebForm15" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".format").each(function () {
&nb