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

  • Home
  • SEARCH
  • 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 7941761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:45:54+00:00 2026-06-03T23:45:54+00:00

I have a page with a few inputs, a validate button as well as

  • 0

I have a page with a few inputs, a validate button as well as some links.

I would like to have the following behaviour: when the user clicks a link, the form is submitted (data is saved) before following the link.

I tried to use jquery form.submit() on link click event, but the data isn’t saved.
If I use event.preventDefault() before form.submit(), data is saved but the link isn’t opened, the action link of the submit button is opened instead.

How could I do this?

  • 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-03T23:45:56+00:00Added an answer on June 3, 2026 at 11:45 pm

    You need to use Ajax for this functionality

    <a href="somepage.html" class="link">Link</a>
    
    $(document).ready(function(){
    $('.link').click(function(e){
    
    var href = $(this).attr('href');
    e.preventDefault();
    //do ajax for saving the data-- refer jquery ajax
    
    $.ajax({
          url:'your form action',
          type:'post',
          data:anydata to send
         success:funtion(msg){ //return a value ok if form saved or fail if form not saved
        if(msg == 'ok'){
        location.href = href; //just redirect
          }    
         }
    
    });    
    });   
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that has a few links that I would like to
I have a page with a few links that are all like this: <a
I have a few simple html text inputs. I would like to check that
I have a JSF Page which gets few inputs from the User, I want
I have a page (telerik:RadPage) containing few grids and some nested controls and I
I have a master page which containing few CSS links and java scripts. <html
I have a simple aspx page with a few TextBoxes and a submit button.
I have a PHP page, that on clicking the submit button process a few
I have a page with a few fields and a runtime-generated image on it.
I have a page that takes a few minutes to run. When I set

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.