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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:13:19+00:00 2026-06-06T09:13:19+00:00

I recently started using jQuery/AJAX for submitting data to my PHP API. Currently what

  • 0

I recently started using jQuery/AJAX for submitting data to my PHP API.

Currently what I’m using is an input type=”button” in the html and then a .click() jQuery function to submit it.

I’m not quite sure it’s the best way to do it though, should I use a input type=”submit” with preventDefault() instead ?

  • 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-06T09:13:20+00:00Added an answer on June 6, 2026 at 9:13 am

    It’s better to use .submit() on the form instead of .click() on the submit button. In both cases preventDefault is necessary though. The reason for that is that the user could submit the form by pressing Enter while editing some field and if you subscribed to the .click event of a button, this event won’t fire.

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

Sidebar

Related Questions

I recently started using Riak with PHP. How exactly do I store JSON data?!
I recently started using Eclipse for PHP Development. Please suggest me some HTML WYSIWYG
I recently started using JQuery and created a little slider to display logos of
I recently started using imagemagick with php and I'm relatively new with both of
I've only recently started using jQuery and am having no problems with most of
Recently I started using https://github.com/crowdint/rails3-jquery-autocomplete It works great, but I was trying to set
I've recently started using the google translate API inside a c# project. I am
Recently, I started using the email validation regular expression from the JQuery validation plugin
[See update for a more precise specification ...] I recently started using the jquery
I recently started using emacs for writing my programs codes. I was wondering if

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.