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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:18:11+00:00 2026-05-18T03:18:11+00:00

This is probably going to sound backwards. I need for a form to submit

  • 0

This is probably going to sound backwards. I need for a form to submit return false, but still submit the form.

I have a form being pulled into a page via ajax (jquery load function), and on submit I’d like to display a graphic and some text in the same div, rather than redirect the page.

This is my submit button (codeigniter):

<?php $attributes = array('class' => 'button', 'onclick' => 'form_success_client(); return false;', 'name' => 'submit'); echo form_submit( $attributes, 'Save'); ?>

and in html:

<input type="submit" onclick="form_success(); return false;" class="button" value="Save" name="submit">

and the javascript function which loads the success message:

 function form_success_client() { // form success
    $('.contentarea').load("/mm/index.php/site/form_success_client/");
 }

That all works fine, but unsurprisngly it doesn’t submit the form. I know that the proper way to do this, is to pass the form submission over to jquery, but I’m not sure how to do that. Could do with a quick fix if possible (until I have time to sort a better solution out), however all suggestions appreciated.

Thanks!

ANSWER:

This is what worked for me, just a slight edit of Maggie’s answer:

function form_success_client(obj) {
    $.ajax({
       type: 'POST',
       url: $(obj).attr('action'),
       data: $(obj).serialize(),
       success: function(msg){
         $('.contentarea').load("/mm/index.php/site/form_success_client/");
       }
     });
     return false;
}

Note the $() wrapping obj on url and data.

  • 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-18T03:18:12+00:00Added an answer on May 18, 2026 at 3:18 am

    bind your JS onclick-event to the form (not the button) like this
    'onclick' => 'form_success_client(this); return false;'

    and change your function to

    function form_success_client(obj) {
        $.ajax({
           type: "POST",
           url: obj.attr("action"),
           data: obj.serialize(),
           success: function(msg){
             $('.contentarea').load("/mm/index.php/site/form_success_client/");
           }
         });
    }
    

    untested

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

Sidebar

Related Questions

This is probably going to be something simple I'm missing, but I have the
Right, this is probably going to be pretty simple. I have a form that
This is probably going to be very obvious, but here goes. I have two
This is probably going to be embarrassing, but here we go! I have the
This is probably going to be an easy thing but I am having a
You can probably see where I am going with this - but is there
This probably sounds like a stupid question, but I'm going to give it a
This is probably going to be more of a discussion or hypothetical question, but
I am probably going about this in the wrong manner, but I was wondering
This is probably going to language dependent, but in general, what is the performance

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.