我在js中制造了一个阵列。
var data = new Array();
data[ id ] = self.iframeFields.id.val();
data[ name ] = self.iframeFields.name.val();
data[ location ] = self.iframeFields.location.val();
data[ about ] = self.iframeFields.about.val();
data[ company ] = self.iframeFields.company.val();
data[ website ] = self.iframeFields.website.val();
但通过<条码> 瓦尔数据代码>
but data[ id ]
return value.
What did I do wrong?
EDIT: After nrabinowitz s answer, i was using
if ($.isArray( data )){ ajax({
url: myurl,
data: {
method: "updateProfile",
data: data
},
normalizeJSON: true,
success: function( response ){
// Check to see if the request was successful.
if (response.success){
alert(response);
} else if (onError){
// The call was not successful - call the error function.
alert(response);
}
}
});
}
因为它不是一个阵列,
它没有归还任何东西。
驱逐
if ($.isArray( data )){ }
解决这个问题。