function submitOrder(UserName, Phone, OrderInfo, _oid) { var zz = /^1[3|4|5|8][0-9]\d{4,8}$/; $("#ErrorInfo").removeAttr("class").addClass("red pl10"); if ($("#" + UserName + "").val() == "" || $("#" + UserName + "").val() == "Please enter your name") { $("#ErrorInfo").empty(); $("#ErrorInfo").append("Please enter your name"); return; } else if ($("#" + Phone + "").val() == "" || $("#" + Phone + "").val() == "Please enter your phone") { $("#ErrorInfo").empty(); $("#ErrorInfo").append("Please enter your phone"); return; } else if (!zz.test($("#" + Phone + "").val())) { $("#ErrorInfo").empty(); $("#ErrorInfo").append("Phone number format is incorrect"); return; } else if ($("#" + OrderInfo + "").val() == "" || $("#" + OrderInfo + "").val() == "Please enter your content") { $("#ErrorInfo").empty(); $("#ErrorInfo").append("Please enter your content"); return; } else if (_oid <= 0) { $("#ErrorInfo").empty(); $("#ErrorInfo").append("Submit data is incorrect, please try again"); } else { $("#ErrorInfo").empty(); $.post("/index.php/form/ajax/", { faid: _oid, name: $("#" + UserName + "").val(), tel: $("#" + Phone + "").val(), content: $("#" + OrderInfo + "").val(), time: $("#time").val(), form: $("#form").val(), ip: $("#ip").val() }, function(msg) { var sta = gav(msg, "state"); var sMsg = gav(msg, "msg"); $("#ErrorInfo").append(sMsg); if (sta == "1") { $("#ErrorInfo").removeAttr("class").addClass("green pl10"); $("#ErrorInfo").show(1000, function() { $("#" + UserName + "").val(""); $("#" + Phone + "").val(""); $("#" + OrderInfo + "").val(""); $("#" + UserName + "").val("Please enter your name"); $("#" + Phone + "").val("Please enter your phone"); $("#" + OrderInfo + "").val("Please enter your content"); }); } else { } }); } } function gav(xMsg, key) { var jMsg = $(xMsg); var s = $(jMsg.find("node[key=" + key + "]")).text(); return s; }