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 428157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:38:52+00:00 2026-05-12T19:38:52+00:00

A form, I use AJAX to transfer the data. The AJAX is triggered by

  • 0

A form, I use AJAX to transfer the data. The AJAX is triggered by onClick=””, I also use JQuery validate(). JQuery validate() is executed after the onclick=“function()”, I would like the JQuery validate() is executed before the onclick=”functionname()”, how to do it?

<?php $addtext=<<<html
<a id="give_comment" href="javascript:void(0)">Supplement</a>
<div id="comment_text" name="comment_text" style="display:none">
<form id="add_text" action="nofile.php"  method="post" onsubmit="return false;">
<textarea  id="giver_comment_text" name="giver_comment_text" rows="6" cols="70" class="font1"></textarea><br/>
<input id="giver_submit_comment" type="submit" value="Submit" onclick="validateDetail()" /></form></div>
<br/>
html;
echo $addtext;
?>

Javascript code:

function validateDetail()
{
  $('#add_text').validate({
        rules:{
            giver_comment_text:{
                required:true,
                minlength:50,
                  maxlength:600 
            }
        },
      });
    var detail=$('#giver_comment_text').val();

//$.post(The content of AJAX);
}
  • 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-05-12T19:38:52+00:00Added an answer on May 12, 2026 at 7:38 pm

    You can remove the function from the onClick handler, and use a submitHandler. Read the documentation, and here’s the sample they provide there:

    $(".selector").validate({   
      submitHandler: function(form) {
      // do other stuff for a valid form
      form.submit();    
      } 
    })
    

    So all you have to do is call function() inside the submitHandler after the form has been validated.

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

Sidebar

Related Questions

I am wanting to use the AJAX function via jQuery to return some data
I have a small jQuery plugin that I use for form AJAX validation. There
I use Ajax (jQuery) and the POST method to update data in the database.
I am trying to use Ajax Form Submit. In the BeforeSubmit function. i want
I was working on a Login Form ( AJAX ) enabled. When a use
I'm trying to use form's CheckboxSelectMultiple widget but I I'd like to change the
I have a contact form i want to use Ajax for. My contact.php script
I want to upload an image use something like <form ...> <input type=file id=upload></input>
i want to use @Ajax.ActionLink to popup a form so i did this in
I want to use AJAX to process a simple login form. I thought it'd

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.