Miel Soeterbroek schreef:
>
> 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);
>
> });
>
> }
>
>
>   
The common way to do this with jquery plugins is

function(options) {
>   var settings = jQuery.extend({
>     name: 'John',
>     surname: 'Doe'
>   }, options || {});
>  $.post(‘save.html’,settings, function(data){ alert(data);});

> };




-- 
David Duymelinck
________________
[EMAIL PROTECTED]


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to