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/

Reply via email to