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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:44:45+00:00 2026-06-05T16:44:45+00:00

i have this form to serialize once i click the submit button, <form class=cashier_forms

  • 0

i have this form to serialize once i click the submit button,

   <form class="cashier_forms" action="<?php echo base_url().'index.php/'.$this->uri->segment(1).'/'.$this->uri->segment(2)?>/addCashierCount" id="form_cashier_count" rel="ajax_message">
       <p id="cashier_count_p" class="hidden">
          <label for="recipe_id">Count</label>
          <input placeholder="Cashier count for this Recipe" class="all_curve_small cashier_inputs" name="cashier_count" id="cashier_id" />
          <input id="yield_recipe_id" type="text" name="yield_id_input" value="<?php echo $ayr_recipe->yieldID?>" />
          <input type="text" name="count_date" value="<?php echo $date_now?>" />
          <input type="submit" class="buttons count_submit" rel="form_<?php echo $this->tbl_count_name ?>" value="Add Count" />
       </p>
    </form>

and this is my jquery which supposedly serializes my form..

   $('.count_submit').click(function(e){
      e.preventDefault();
      var form    = '#'+ $(this).attr('rel');
      var url  = $(form).attr('action');
      var target  = '#'+ $(form).attr('rel');
      $(target).slideUp();
      $.post(url, $(form).serialize(),function(data) {
         $(target).html(data).slideDown(function(){
            if(data == '<div class="ok">Added</div>'){
            setTimeout(refresh,3000)
            window.location = '<?php echo base_url()?>index.php/cashier/cashier_lo';
            }
         });
      });
    });

but when the action is being processed, it stores no data, i think the form is not being serialized..can someone please check if i miss sumthing?

  • 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-05T16:44:46+00:00Added an answer on June 5, 2026 at 4:44 pm

    This doesn’t give you the form:

    var form = '#'+ $(this).attr('rel');
    

    This gives you the rel attribute of the submit button (which by the way doesn’t even have such attribute). And then it is meaningless to call the .serialize() method on it. To access the form. Remember that inside your click handler this points to the element that was clicked (a.k.a the button, not the form). So:

    var form = $(this).closest('form');
    

    This being said a much better thing is to subscribe to the submit event of the form, not the click event of the button. What if the user presses Enter while inside the input field? The form will be submitted and your click handler will never run.

    So let’s clean things up:

    $('#form_cashier_count').submit(function(e) {
        e.preventDefault();
        var form = $(this);
        var target = form.attr('rel');
        $(target).slideUp();
        $.post(this.action, form.serialize(), function(data) {
            $(target).html(data).slideDown(function() {
                if (data == '<div class="ok">Added</div>') {
                    setTimeout(refresh, 3000);
                    window.location = '<?php echo base_url()?>index.php/cashier/cashier_lo';
                }
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code right here: $('#add_club_button').click(function(){ $('#add_club_button_ajax').show(); $.post('<?php echo base_url()?>addClub/save',$('#add_club_form').serialize(),function(data){ if(data == 'OK'){
I have this form: <%= form_tag posts_path, :method => :get, :class => search_nav do
I have this form with a date input. echo $this->Form->create('Nodata'); echo $this->Form->input('date1', array('type' =>
I have this form: <form> <div class=box> <h1>Contact form :</h1> <label> <span>Typ: </span> <input
I have this form submit code: Event.observe(window, 'load', init, false); function init() { Event.observe('addressForm',
I have this ajax function: function callpage() { $('#formcontent').empty().html('<p class=vent>Pleace wait</p>'); var form =
Right now I have a script that will update once the submit button is
I have this issue with my form that once its submitted, you will get
i have this form: <form name=myForm action=#> <input type=text name=firstField /> <input type=text name=secondField
I have this ajax jquery code: var form = document.getElementById('frm'); var data_string = form.serialize();

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.