- var params = new
Array():
Probably a typo, but I thought I'd mention it. - Possibly {} creates an object not an array? In which case change
var params = new Array();
to
var params = new Object();
Blair
Howdy!
Consider the following two pieces of code:
function someFunction() {
var params = {
name: 'John',
surname: 'Doe'
};
$.post('save.html', params, function(data) {
alert(data);
});
}
This works just fineā¦
The following piece of code doesn't:
function someFunction() {
var params = new Array():
params['name'] = 'John';
params['surname'] = 'Doe';
$.post('save.html', params, function(data) {
alert(data);
});
}
Am I just missing some _javascript_ array basics (which is totally possible) or is there something weird going on here.
Since I need to post a variable number of variables, with variable names as well, i need something like the second example.
Thanks,
Miel
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/