Asp.NET MVC ajax
asp.net mvc js验证:
jquery.validate.js
<script type="text/javascript"> $(function() { $("form").validate({ errorClass: "field-validation-error", rules: { "pledge.SupporterName": { required: true, maxlength: 50 }, "pledge.SupporterEmail": { required: true, email: true }, "pledge.Amount": { required: true, min: 10 } }, messages: { "pledge.Amount": { min: "Come on, you can give at least $10.00!" } } }) }); </script>
<%-- $("form[action$='GetQuote']").submit(function() { $.post($(this).attr("action"), $(this).serialize(), function(response) { $("#results").html(response); }); return false; }); $("form[action$='GetQuote']").submit(function() { $.getJSON($(this).attr("action"), $(this).serialize(), function(stockData) { $("#openingPrice").html(stockData.OpeningPrice); $("#closingPrice").html(stockData.ClosingPrice); $("#stockRating").html(stockData.Rating); }); return false; }); --%> <%: Ajax.ActionLink("显示时间", "ShowMessage", new { username = "xxx" }, new AjaxOptions { Confirm = "确定吗", HttpMethod="Post" , UpdateTargetId = "divMsg", LoadingElementId = "dvLoading", OnSuccess="fun_suc", InsertionMode=InsertionMode.InsertAfter, OnBegin="fun_beg" })%> <div id="divMsg" style="border:1px solid red;"> </div>