fklsdkljflkj341
??? ??
2016-06-21 03:50

怎么alert data input 里面的值

 <script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
    $("#submit").click(function () {
        $.ajax({
            url: '/AjaxForm/Index',
            type: "POST",
            data: $('#form').serialize(),

            success: function (data) {
              //  $("#result").text(data);
                alert(data)
            }
        });
    });
    $("#form").submit(function () {
        $.ajax({
            url: '/AjaxForm/Index',
            type: "POST",
            data: $('#form').serialize(),

            success: function (data) {
                //$("#result").text(data);
                alert(data)
            }
        });
    });
</script>
<h2>Index</h2>
<form id="form">
    <input name="data" type="text">
    <input type="button" value="提交" id="submit">
    <input type="submit" value="submit"  id="sub"/>
</form>
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐

换一换