How to catch error jQuery via Model of MVC
I have Form with jQuery, this's link:
http://jqueryui.com/dialog/#modal-form
I want to catch error by Model, i'm looking for many website but have no result.
My javascrip:
- $(function () {
- var name = $("#name").val(),
- email = $("#email").val(),
- password = $("#password").val(),
- allFields = $([]).add(name).add(email).add(password),
- tips = $(".validateTips");
- $(function () {
- $("#create-user")
- .button()
- .click(function () {
- $("#dialog-form").dialog("open");
- });
- });
- $("#dialog-form").dialog({
- autoOpen: false,
- modal: true,
- buttons: {
- "Create an account": function () {
- allFields.removeClass("ui-state-error");
- $(function () {
- // i want to catch error in here via Model of MVC
- });
- $("#users tbody").append("<tr>" +
- "<td>" + name.val() + "</td>" +
- "<td>" + email.val() + "</td>" +
- "<td>" + password.val() + "</td>" +
- "</tr>");
- $(this).dialog("close");
- },
- Cancel: function () {
- $(this).dialog("close");
- }
- },
- close: function () {
- allFields.val("").removeClass("ui-state-error");
- }
- });
- });