日期:2014-05-17  浏览次数:20408 次

谁能帮我看看为什么我的jQuery ajax数据提交不过去
<script type="text/javascript">
    function cheshi(id) {
        $.ajax({
            type: "POST",
            url: "/tools/admin_ajax.ashx?action=cheshi",
            data: { id:id },
            dataType: "json",
            beforeSend: function (XMLHttpRequest) {
                //发送前动作
            },
            success: function (data, textStatus) {
                $("#div1").text(data.word_ename);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $("#div1").text("错误");
            } 
            
        });
    }


</script>

<div id="div1">123</div>
  <img alt="" src="../../images/msg.png"  onclick="cheshi(2)"/>

 case "cheshi": //
                    cheshi(context);
                    break;

 private void cheshi(HttpContext context)
        {
            int id = DTRequest.GetFormInt("id");
            
            BLL.word bl=new BLL.word();
            Model.Word wo=new Model.Word();
            wo = bl.GetGoodsModel(id);
            context.Response.Write("{\"word_ename\":" + wo.word_ename + ", \"word_cname\":" + wo.word_cname + "}");
            return;
        }

    通过点击页面上的img标签,把id提交到.ashx里查询到一条记录,把查询的记录返回到html页面并覆盖到div里。现在我点img标签标签一点反应也没有。求大家帮我改改,初学jQuery很多问题都不明白
asp.net C# jQuery ajax