I want to make a JavaScript array
and pass it to another page in php via post request I get an error in firebug:
我想创建一个JavaScript数组并通过post请求将其传递给php中的另一个页面我在firebug中收到错误:
ReferenceError: array is not defined
ReferenceError:未定义数组
Here's the code:
这是代码:
$(document).ready(function(){
var data = new array(); // this line throws the error
// Handle Submiting form data
$("#btnSumbit").click(function (){
$('#tblCriteria input[type=text]').each(
function(){
data[this.id] = this.value;
}
);
This code inside cakePHP
view.
这个代码在cakePHP视图里面。
1 个解决方案
#1
16
JavaScript is case sensitive, so to create a new array write Array
with a capital letter:
JavaScript区分大小写,因此要创建一个带有大写字母的新数组写入数组:
var data = new Array();
However you may always use a short version:
但是,您可能总是使用简短版本:
var data = [];
#1
16
JavaScript is case sensitive, so to create a new array write Array
with a capital letter:
JavaScript区分大小写,因此要创建一个带有大写字母的新数组写入数组:
var data = new Array();
However you may always use a short version:
但是,您可能总是使用简短版本:
var data = [];