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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:25:49+00:00 2026-06-17T13:25:49+00:00

i have a form in my view page …..as i want to send data

  • 0

i have a form in my view page …..as i want to send data through jquery or ajax because i dont want to reload or refresh the page . i am sending data through jquery serialize.. but all the fields are not submitting through serialize.. here first dropdown which is “supplier” is going empty .. means jquery serialize is not capturing his value and i think there may be same situation for the rest of others .. why is that so ..here is my view page
my form name and id is “form”

  <?php  echo form_open('stockInController/addStockIn', $attributes);?>

 <!-- Supplier -->


Select a Supplier

 <select name="sup_id" id="sup_id" class='cho'>
  <option id="y" value="0">--Select--</option>
  <?php foreach($records1 as $r) { ?>
  <option value="<?=$r->sup_id?>">
   <?=$r->sup_name?>
  </option>
  <?php } ?>
  </select>

<!-- end of Supplier -->



     Date:<?php echo form_input($date); ?>
     Bill No: <?php echo form_input($bill_no); ?>




 <table>
  <tr>
   <th>Category:</th>
   <th>Items:</th>
   <th>Selling Price:</th>
   <th>quantity:</th>
   <th>total:</th>
  </tr>

        <?php for ($i = 0; $i < 5; $i++) { ?>
  <tr>
      <td>
         <?php echo form_dropdown ('cat_id'.$i,   $records2,'#',     "id='category_".$i."'onchange='getItems(this.value,".$i.")' ");?>
   </td>




       <td> <?php echo form_dropdown('item_id'.$i, $records3, '#',    "id='items_".$i."'"); ?>

   </td>




<td> <input type="text" name = "price_<?php echo $i ?>" id = "price_<?php echo $i  ?>"    echo "$i"?>)'>
   </td>

     <td><input type="text" name = "quantity_<?php echo $i ?>"
                           id = "quantity_<?php echo $i ? >"  echo "$i"?>)'>
   </td>

   <td><input type="text"name = "total_<?php echo $i ?>" id = "total_<?php echo $i ?>">
   </td>
  </tr>


  <?php }?>

  <tr>

      <td>
    <?php echo form_button($button); ?>
    <?php form_close();?>
   </td></tr>

here is my jquery function

     $('#btn').click(function(event) {
    form = $("#form").serialize();

  $.ajax({
    type: "POST",
    url: "<?php  echo site_url('stockInController/addStockIn'); ?
    data: form,

    success: function(data){
   alert("true");

    }

  });
  event.preventDefault();
  return false;

}); 
  • 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-17T13:25:51+00:00Added an answer on June 17, 2026 at 1:25 pm

    First make sure you are captuering the form object. Try capturing form with id.

     <?php  echo form_open('stockInController/addStockIn', "id = 'form_id'");?>
    

    With JQuery

    var form = $('#form_id').serialize();
    

    Also defining a variable in javascript requires VAR keyword which you are missing.
    The third thing you are missing ” in url

    url: "<?php  echo site_url('stockInController/addStockIn'); ?>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two form fields on my view page, a date input (with a
I have a form in a Code Igniter view in my jQuery Mobile application.
I have a form in my view page on submit a function in a
I have a problem when I try put data from controller to form view
I'm building a page where I want to have a form that posts to
Using codeigniter 2.1.2, I have a form view loaded through a controller that takes
I have a form in my view page.it contains 5 text boxes,one search button.while
I have a simple form on a view page, implemented as a user control,
I have a form view which people use to update a record in the
this time it's about Ruby On Rails. I have a form in the view

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.