Submit Array from view to controller using ajax (Codeigniter)
I'm very new in web programming, especially on Codeigniter. And now I'm looking for how to pass/submit array from view to controller.
This part of my HTML script in view:
<tr class="rowdim"> <!-- ROW 1 -->
<td><input type="text" id="bookid1" name="book_id" /></td>
<td><input type="text" id="qty1" name="qty" /></td>
<td><input type="text" id="uom1" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 2 -->
<td><input type="text" id="bookid2" name="book_id" /></td>
<td><input type="text" id="qty2" name="qty" /></td>
<td><input type="text" id="uom2" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 3 -->
<td><input type="text" id="bookid3" name="book_id" /></td>
<td><input type="text" id="qty3" name="qty" /></td>
<td><input type="text" id="uom3" name="uom_id" /></td>
</tr>
My ajax:
var det_book = document.getElementsByName("book_id");
var det_qty = document.getElementsByName("qty");
var det_uom = document.getElementsByName("uom_id");
var vdata = {det_book:det_book,det_qty:det_qty,det_uom:det_uom}
$.ajax({
type:"POST",
url:"<?php echo base_url(); ?>trans/StockIn/saveData",
data:vdata,
success:function(returnmsg){
if (returnmsg=='""'){
window.alert(msg);
} else {
window.alert(returnmsg);
}
});
Controller:
$det_book=$_POST["det_book"];
$det_qty=$_POST["det_qty"];
$det_uom=$_POST["det_uom"];
$details = array();
$index=0;
foreach ($det_book as $baris){
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
$index++; }
$error="";
if (!$this->db->insert_batch('trx_inbound_detail',$details))
{
$error = $this->db->error();
}
Any miss or something wrong with my code?
Already search in community but still no luck.
Appreciate if you also suggest other ways.
Thanks
php arrays ajax codeigniter controller
add a comment |
I'm very new in web programming, especially on Codeigniter. And now I'm looking for how to pass/submit array from view to controller.
This part of my HTML script in view:
<tr class="rowdim"> <!-- ROW 1 -->
<td><input type="text" id="bookid1" name="book_id" /></td>
<td><input type="text" id="qty1" name="qty" /></td>
<td><input type="text" id="uom1" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 2 -->
<td><input type="text" id="bookid2" name="book_id" /></td>
<td><input type="text" id="qty2" name="qty" /></td>
<td><input type="text" id="uom2" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 3 -->
<td><input type="text" id="bookid3" name="book_id" /></td>
<td><input type="text" id="qty3" name="qty" /></td>
<td><input type="text" id="uom3" name="uom_id" /></td>
</tr>
My ajax:
var det_book = document.getElementsByName("book_id");
var det_qty = document.getElementsByName("qty");
var det_uom = document.getElementsByName("uom_id");
var vdata = {det_book:det_book,det_qty:det_qty,det_uom:det_uom}
$.ajax({
type:"POST",
url:"<?php echo base_url(); ?>trans/StockIn/saveData",
data:vdata,
success:function(returnmsg){
if (returnmsg=='""'){
window.alert(msg);
} else {
window.alert(returnmsg);
}
});
Controller:
$det_book=$_POST["det_book"];
$det_qty=$_POST["det_qty"];
$det_uom=$_POST["det_uom"];
$details = array();
$index=0;
foreach ($det_book as $baris){
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
$index++; }
$error="";
if (!$this->db->insert_batch('trx_inbound_detail',$details))
{
$error = $this->db->error();
}
Any miss or something wrong with my code?
Already search in community but still no luck.
Appreciate if you also suggest other ways.
Thanks
php arrays ajax codeigniter controller
Replacevar det_uom = document.getElementsByName("uom_id");
withvar det_uom = document.getElementsByName("uom");
– Twinkle
Nov 21 '18 at 3:48
Edited. Passing done, controller still got issue. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: trans/StockIn.php Line Number: 98 Backtrace: File: D:xampphtdocspenerbitapplicationcontrollerstransStockIn.php Line: 98 Function: _error_handler
– HooHoo
Nov 21 '18 at 3:58
Did you check with the browser's dev tools or the console?
– gre_gor
Nov 21 '18 at 17:09
add a comment |
I'm very new in web programming, especially on Codeigniter. And now I'm looking for how to pass/submit array from view to controller.
This part of my HTML script in view:
<tr class="rowdim"> <!-- ROW 1 -->
<td><input type="text" id="bookid1" name="book_id" /></td>
<td><input type="text" id="qty1" name="qty" /></td>
<td><input type="text" id="uom1" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 2 -->
<td><input type="text" id="bookid2" name="book_id" /></td>
<td><input type="text" id="qty2" name="qty" /></td>
<td><input type="text" id="uom2" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 3 -->
<td><input type="text" id="bookid3" name="book_id" /></td>
<td><input type="text" id="qty3" name="qty" /></td>
<td><input type="text" id="uom3" name="uom_id" /></td>
</tr>
My ajax:
var det_book = document.getElementsByName("book_id");
var det_qty = document.getElementsByName("qty");
var det_uom = document.getElementsByName("uom_id");
var vdata = {det_book:det_book,det_qty:det_qty,det_uom:det_uom}
$.ajax({
type:"POST",
url:"<?php echo base_url(); ?>trans/StockIn/saveData",
data:vdata,
success:function(returnmsg){
if (returnmsg=='""'){
window.alert(msg);
} else {
window.alert(returnmsg);
}
});
Controller:
$det_book=$_POST["det_book"];
$det_qty=$_POST["det_qty"];
$det_uom=$_POST["det_uom"];
$details = array();
$index=0;
foreach ($det_book as $baris){
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
$index++; }
$error="";
if (!$this->db->insert_batch('trx_inbound_detail',$details))
{
$error = $this->db->error();
}
Any miss or something wrong with my code?
Already search in community but still no luck.
Appreciate if you also suggest other ways.
Thanks
php arrays ajax codeigniter controller
I'm very new in web programming, especially on Codeigniter. And now I'm looking for how to pass/submit array from view to controller.
This part of my HTML script in view:
<tr class="rowdim"> <!-- ROW 1 -->
<td><input type="text" id="bookid1" name="book_id" /></td>
<td><input type="text" id="qty1" name="qty" /></td>
<td><input type="text" id="uom1" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 2 -->
<td><input type="text" id="bookid2" name="book_id" /></td>
<td><input type="text" id="qty2" name="qty" /></td>
<td><input type="text" id="uom2" name="uom_id" /></td>
</tr>
<tr class="rowdim"> <!-- ROW 3 -->
<td><input type="text" id="bookid3" name="book_id" /></td>
<td><input type="text" id="qty3" name="qty" /></td>
<td><input type="text" id="uom3" name="uom_id" /></td>
</tr>
My ajax:
var det_book = document.getElementsByName("book_id");
var det_qty = document.getElementsByName("qty");
var det_uom = document.getElementsByName("uom_id");
var vdata = {det_book:det_book,det_qty:det_qty,det_uom:det_uom}
$.ajax({
type:"POST",
url:"<?php echo base_url(); ?>trans/StockIn/saveData",
data:vdata,
success:function(returnmsg){
if (returnmsg=='""'){
window.alert(msg);
} else {
window.alert(returnmsg);
}
});
Controller:
$det_book=$_POST["det_book"];
$det_qty=$_POST["det_qty"];
$det_uom=$_POST["det_uom"];
$details = array();
$index=0;
foreach ($det_book as $baris){
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
$index++; }
$error="";
if (!$this->db->insert_batch('trx_inbound_detail',$details))
{
$error = $this->db->error();
}
Any miss or something wrong with my code?
Already search in community but still no luck.
Appreciate if you also suggest other ways.
Thanks
php arrays ajax codeigniter controller
php arrays ajax codeigniter controller
edited Nov 21 '18 at 3:54
HooHoo
asked Nov 21 '18 at 2:43
HooHooHooHoo
32
32
Replacevar det_uom = document.getElementsByName("uom_id");
withvar det_uom = document.getElementsByName("uom");
– Twinkle
Nov 21 '18 at 3:48
Edited. Passing done, controller still got issue. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: trans/StockIn.php Line Number: 98 Backtrace: File: D:xampphtdocspenerbitapplicationcontrollerstransStockIn.php Line: 98 Function: _error_handler
– HooHoo
Nov 21 '18 at 3:58
Did you check with the browser's dev tools or the console?
– gre_gor
Nov 21 '18 at 17:09
add a comment |
Replacevar det_uom = document.getElementsByName("uom_id");
withvar det_uom = document.getElementsByName("uom");
– Twinkle
Nov 21 '18 at 3:48
Edited. Passing done, controller still got issue. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: trans/StockIn.php Line Number: 98 Backtrace: File: D:xampphtdocspenerbitapplicationcontrollerstransStockIn.php Line: 98 Function: _error_handler
– HooHoo
Nov 21 '18 at 3:58
Did you check with the browser's dev tools or the console?
– gre_gor
Nov 21 '18 at 17:09
Replace
var det_uom = document.getElementsByName("uom_id");
with var det_uom = document.getElementsByName("uom");
– Twinkle
Nov 21 '18 at 3:48
Replace
var det_uom = document.getElementsByName("uom_id");
with var det_uom = document.getElementsByName("uom");
– Twinkle
Nov 21 '18 at 3:48
Edited. Passing done, controller still got issue. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: trans/StockIn.php Line Number: 98 Backtrace: File: D:xampphtdocspenerbitapplicationcontrollerstransStockIn.php Line: 98 Function: _error_handler
– HooHoo
Nov 21 '18 at 3:58
Edited. Passing done, controller still got issue. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: trans/StockIn.php Line Number: 98 Backtrace: File: D:xampphtdocspenerbitapplicationcontrollerstransStockIn.php Line: 98 Function: _error_handler
– HooHoo
Nov 21 '18 at 3:58
Did you check with the browser's dev tools or the console?
– gre_gor
Nov 21 '18 at 17:09
Did you check with the browser's dev tools or the console?
– gre_gor
Nov 21 '18 at 17:09
add a comment |
2 Answers
2
active
oldest
votes
Your first mistake is get the textbox value in multiple fields:
var det_book = $('input[name^=book_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_qty = $('input[name^=qty]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_uom = $('input[name^=uom_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
In php you didnot mention the index in foreach:
foreach ($det_book as $index => $baris) {
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
}
print_r($details);
exit();
1
Yes, actually I don't understand to get thetextbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)
– HooHoo
Nov 22 '18 at 10:27
add a comment |
Yes, you missed something.
Element with name book_id
doesn't exist. Also you have three inputs with same name.
Check this link to see how to pass array with ajax.
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Just found the problem is in this part:var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?
– HooHoo
Nov 22 '18 at 2:51
@HooHoo Removefrom
name
tag. Btw. what console(in browser) says
– SilvioCro
Nov 22 '18 at 3:09
It saysUncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracketfrom name tag
– HooHoo
Nov 22 '18 at 8:02
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404588%2fsubmit-array-from-view-to-controller-using-ajax-codeigniter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your first mistake is get the textbox value in multiple fields:
var det_book = $('input[name^=book_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_qty = $('input[name^=qty]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_uom = $('input[name^=uom_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
In php you didnot mention the index in foreach:
foreach ($det_book as $index => $baris) {
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
}
print_r($details);
exit();
1
Yes, actually I don't understand to get thetextbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)
– HooHoo
Nov 22 '18 at 10:27
add a comment |
Your first mistake is get the textbox value in multiple fields:
var det_book = $('input[name^=book_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_qty = $('input[name^=qty]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_uom = $('input[name^=uom_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
In php you didnot mention the index in foreach:
foreach ($det_book as $index => $baris) {
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
}
print_r($details);
exit();
1
Yes, actually I don't understand to get thetextbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)
– HooHoo
Nov 22 '18 at 10:27
add a comment |
Your first mistake is get the textbox value in multiple fields:
var det_book = $('input[name^=book_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_qty = $('input[name^=qty]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_uom = $('input[name^=uom_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
In php you didnot mention the index in foreach:
foreach ($det_book as $index => $baris) {
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
}
print_r($details);
exit();
Your first mistake is get the textbox value in multiple fields:
var det_book = $('input[name^=book_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_qty = $('input[name^=qty]').map(function(idx, elem) {
return $(elem).val();
}).get();
var det_uom = $('input[name^=uom_id]').map(function(idx, elem) {
return $(elem).val();
}).get();
In php you didnot mention the index in foreach:
foreach ($det_book as $index => $baris) {
array_push($details,array(
'book_id'=>$baris,
'quantity'=>$det_qty[$index],
'uom_id'=>$det_uom[$index]
));
}
print_r($details);
exit();
answered Nov 22 '18 at 8:45
ManiMani
34727
34727
1
Yes, actually I don't understand to get thetextbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)
– HooHoo
Nov 22 '18 at 10:27
add a comment |
1
Yes, actually I don't understand to get thetextbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)
– HooHoo
Nov 22 '18 at 10:27
1
1
Yes, actually I don't understand to get the
textbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)– HooHoo
Nov 22 '18 at 10:27
Yes, actually I don't understand to get the
textbox
in multiple fields. Using your method, it's work. Thanks a lot for your help :)– HooHoo
Nov 22 '18 at 10:27
add a comment |
Yes, you missed something.
Element with name book_id
doesn't exist. Also you have three inputs with same name.
Check this link to see how to pass array with ajax.
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Just found the problem is in this part:var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?
– HooHoo
Nov 22 '18 at 2:51
@HooHoo Removefrom
name
tag. Btw. what console(in browser) says
– SilvioCro
Nov 22 '18 at 3:09
It saysUncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracketfrom name tag
– HooHoo
Nov 22 '18 at 8:02
add a comment |
Yes, you missed something.
Element with name book_id
doesn't exist. Also you have three inputs with same name.
Check this link to see how to pass array with ajax.
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Just found the problem is in this part:var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?
– HooHoo
Nov 22 '18 at 2:51
@HooHoo Removefrom
name
tag. Btw. what console(in browser) says
– SilvioCro
Nov 22 '18 at 3:09
It saysUncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracketfrom name tag
– HooHoo
Nov 22 '18 at 8:02
add a comment |
Yes, you missed something.
Element with name book_id
doesn't exist. Also you have three inputs with same name.
Check this link to see how to pass array with ajax.
Yes, you missed something.
Element with name book_id
doesn't exist. Also you have three inputs with same name.
Check this link to see how to pass array with ajax.
answered Nov 21 '18 at 3:00
SilvioCroSilvioCro
158113
158113
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Just found the problem is in this part:var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?
– HooHoo
Nov 22 '18 at 2:51
@HooHoo Removefrom
name
tag. Btw. what console(in browser) says
– SilvioCro
Nov 22 '18 at 3:09
It saysUncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracketfrom name tag
– HooHoo
Nov 22 '18 at 8:02
add a comment |
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Just found the problem is in this part:var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?
– HooHoo
Nov 22 '18 at 2:51
@HooHoo Removefrom
name
tag. Btw. what console(in browser) says
– SilvioCro
Nov 22 '18 at 3:09
It saysUncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracketfrom name tag
– HooHoo
Nov 22 '18 at 8:02
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
edited, but looked like the error comes from controller, in foreach part
– HooHoo
Nov 21 '18 at 3:57
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Check for errors from JS side, if JS is okey then problem is with PHP.
– SilvioCro
Nov 21 '18 at 4:08
Just found the problem is in this part:
var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?– HooHoo
Nov 22 '18 at 2:51
Just found the problem is in this part:
var det_book = document.getElementsByName("book_id")
capturing array data in JS from the input name. because when i try hardcode the array, everything's going fine. Any idea?– HooHoo
Nov 22 '18 at 2:51
@HooHoo Remove
from name
tag. Btw. what console(in browser) says– SilvioCro
Nov 22 '18 at 3:09
@HooHoo Remove
from name
tag. Btw. what console(in browser) says– SilvioCro
Nov 22 '18 at 3:09
It says
Uncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracket
from name tag– HooHoo
Nov 22 '18 at 8:02
It says
Uncaught RangeError: Maximum call stack size exceeded at Object.toString (<anonymous>)
Still same error even I remove the bracket
from name tag– HooHoo
Nov 22 '18 at 8:02
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404588%2fsubmit-array-from-view-to-controller-using-ajax-codeigniter%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Replace
var det_uom = document.getElementsByName("uom_id");
withvar det_uom = document.getElementsByName("uom");
– Twinkle
Nov 21 '18 at 3:48
Edited. Passing done, controller still got issue. A PHP Error was encountered Severity: Warning Message: Invalid argument supplied for foreach() Filename: trans/StockIn.php Line Number: 98 Backtrace: File: D:xampphtdocspenerbitapplicationcontrollerstransStockIn.php Line: 98 Function: _error_handler
– HooHoo
Nov 21 '18 at 3:58
Did you check with the browser's dev tools or the console?
– gre_gor
Nov 21 '18 at 17:09