Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9118673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:12:38+00:00 2026-06-17T05:12:38+00:00

I have form that sends message me when enter Email and MessageText. I want

  • 0

I have form that sends message me when enter Email and MessageText. I want to use both of jQuery Validation Engine plugin and ajax response to return result. For this I use same jQuery('#messageSendButton').click() function in every case.

To return response from controller:

<script type="text/javascript">
                jQuery('#messageSendButton').click(function () {

                    var url = '@Url.Action("SendQuickMessage", "Home")';
                    var email = $('#email').val();
                    var messageText = $('#messageText').val();

                    $.ajax({
                        url: url,
                        type: 'GET',
                        contentType: 'application/json',
                        data: { Email: email, Message: messageText },
                        success: function (result) {
                            if (result.success) {
                                alert("Message sent! Thanks!");
                            }
                            else {
                                alert("Error occured!");
                            }
                        },

                        complete: function () {
                            $(".loading").hide();
                        }
                    });
                });
            </script>

And, to validate form:

  <script type="text/javascript">
                jQuery(document).ready(function () {
                    jQuery('#quickMessageForm').validationEngine('init');
                    jQuery('#messageSendButton').click(function () {
                        jQuery('#quickMessageForm .loading').animate({ opacity: 1 }, 250);
                        if (jQuery('#quickMessageForm').validationEngine('validate')) {

                            jQuery.post('/Home/SendQuickMessage', {
                                Email: jQuery('#email').val(),
                                Message: jQuery('#message').val(),
                                formname: 'messageForm',
                                formtype: 'messageF'
                            }, function () {
                                jQuery('#quickMessageForm .loading').hide();
                            });

                            return false;
                        } else {
                         jQuery('#quickMessageForm .loading').animate({ opacity: 0 }, 250);
                            return false;
                        }
                    });
                });
            </script>

Separately, they both works alone, but together, firstly ajax function works, second validation works. it is not right.. How can I combine those in one? Firstly to validate form, then get ajax response.

Edit:

Here is form:

 <form action="#" method="post" id="quickMessageForm">
            <div class="form_info cmsms_input">
                <label>Email<span class="color_3"> *</span></label>
                @Html.TextBoxFor(model => model.Email, new { name = "email", id = "email", tabidex = 1, @class = "validate[required,custom[email]]" })
            </div>
            <div class="form_info cmsms_textarea">
                <label>Message<span class="color_3"> *</span></label>
                @Html.TextAreaFor(model => model.Message, new { id = "messageText", name = "messageText", tabindex = 2, @class = "validate[required,minSize[10]]" })
            </div>
            <div class="loading"></div>
            <div>
                <input type="submit" name="messageSendButton" id="messageSendButton" value="Send" class="button_small" tabindex="3" />
            </div>
        </form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:12:40+00:00Added an answer on June 17, 2026 at 5:12 am

    You can try like below.

    i.e. make your ajax call async:false

    $.ajax({
    url: restmethod,
    type: "POST",
    contentType: "application/json",
    async:false
    success: function(data) {
        return data.d; 
    }
    });
    

    I hope this will help to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple web form that sends and email out via .NET C#.
I have form partial that allows the user to enter the subject and message
I'm using the jQuery form wizard plugin. I have 20 questions that each have
I have a form that sends money value e.g <input type=text name=amount value=N50,000.00 NGN
I have a form that sends info into a database table. I have it
I have a php form that saves the info to my database and sends
I have a contact page (contact.php) that sends a form (formsend.php) when people fill
A theoretically question: I have a C# Windows Form app, that sends back some
I currently have a web form aspx page that calls RegisterClientScriptBlock. This sends down
I have a form that I want to be validated before showing it initially.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.