views:

20

answers:

0

http://stackoverflow.com/questions/3205565/jquery-function-probem

I have managed to get the above plugin working with your suggetions. However, now I want to change it slightly to make it more generic.

I want to pass in callbackFunctionSingleAddress and callbackFunctionMultipleAddress as well as how many parameters they expect in the settings. This way I don't have to set them in the plugin it self like I'm doing above. for instance, see below..

if (addresses.length == 0)

                    alert('Your address could not be found, please enter it manually');

                else if (addresses.length == 1) {
                    settings.callbackFunctionSingleAddress(
                        addresses[0].addressLine1,
                        addresses[0].addressLine2,
                        addresses[0].addressLine3,
                        addresses[0].town,
                        settings.TextboxHouseNumber,
                        settings.postcodeClass,
                        settings.addressTownCityClass,
                        settings.addressLine1Class,
                        settings.addressLine2Class,
                        settings.addressLine3Class
                        );
                } else if (addresses.length > 1) {
                    settings.callbackFunctionMultipleAddress(
                        settings.callbackFunctionSingleAddress,
                        addresses,
                        settings.useExternalProcessPage,
                        settings.TextboxHouseNumber,
                        settings.postcodeClass,
                        settings.addressTownCityClass,
                        settings.addressLine1Class,
                        settings.addressLine2Class,
                        settings.addressLine3Class
                        );
                }

is there a way to do this in the setings? and if so What changes I have to do get it working?