required: true, email: true }, comment: { required: true, minlength: 2 }, home_phone: { require_from_group: [1, ".phone-group"] }, agreetspp: { required: true }, zipCode: { required: true }, g_recaptcha_response: { required: true } }, /* @validation error messages ---------------------------------------------- */ messages: { fullname: { required: 'Enter Full name' }, useremail: { required: 'Enter email address', email: 'Enter a VALID email address' }, home_phone: { require_from_group: 'Enter contact phone number' }, zipCode: { required: 'Enter ZipCode' }, agreetspp: { required: 'It is required to email attorney' }, comment: { required: 'Enter your case information' }, g_recaptcha_response: { required: 'Check reCaptcha for verification' } }, /* @validation highlighting + error placement ---------------------------------------------------- */ highlight: function (element, errorClass, validClass) { $(element).closest('.field').addClass(errorClass).removeClass(validClass); }, unhighlight: function (element, errorClass, validClass) { $(element).closest('.field').removeClass(errorClass).addClass(validClass); }, errorPlacement: function (error, element) { if (element.is(":radio") || element.is(":checkbox")) { element.closest('.option-group').after(error); } else { error.insertAfter(element.parent()); } } }); }); function SendEmail() { if ($("#Form1").valid()) { var contactAtt = {}; contactAtt.id = '43254'; contactAtt.companyName = 'Test'; contactAtt.companyInfo = $('#attinfo').html(); contactAtt.fullName = $('#fullname').val(); contactAtt.emailId = $('#useremail').val(); contactAtt.phoneNum = $('#home_phone').val(); contactAtt.zipCode = $('#zipCode').val(); contactAtt.CaseDescription = $('#comment').val(); /*alert(JSON.stringify(contactAtt)); */ $.ajax({ type: "POST", url: HelperSiteVars.ApplicationRelativeWebRoot + "api/l4ahelper.asmx/SendAttorneyEmail", data: JSON.stringify(contactAtt), contentType: "application/json; charset=utf-8", dataType: "json", beforeSend: onAjaxBeforeSend, success: OnSuccess, failure: function (response) { alert(response.d); }, error: function (xhr, textStatus, errorThrown) { alert("FAIL: " + xhr + " " + textStatus + " " + errorThrown); alert(xhr.responseText); } }); } else { /*alert('Not valid');*/ } } function onAjaxBeforeSend(jqXHR, settings) { // AJAX calls need to be made directly to the real physical location of the // web service/page method. For this, SiteVars.ApplicationRelativeWebRoot is used. // If an AJAX call is made to a virtual URL (for a blog instance), although // the URL rewriter will rewrite these URLs, we end up with a "405 Method Not Allowed" // error by the web service. Here we set a request header so the call to the server // is done under the correct blog instance ID. jqXHR.setRequestHeader('x-blog-instance', HelperSiteVars.BlogInstanceId); } function OnSuccess(response) { //alert(response.d); alert("Email has been successfully sent."); }
Address: | |
Telephone: | |
Website: | |
Rating: | |