$('#btnAfterExtraServicesSelected').die('click').live('click', function () {
var keys = $('#extras input:checked').map(function () { return $(this).val(); }).get();
var pets = $('#pets input:checked').map(function () { return $(this).val(); }).get();
var selectedExtraServices = {};
for (var i = 0, l = pets.length; i < l; i++) {
if (pets[i]) {
var selectedPetKeys = [];
var name = pets[i] + '-';
for (var j = 0, k = keys.length; j < k; j++) {
if (keys[j].substring(0, name.length) == name) {
selectedPetKeys.push(keys[j].substr(name.length));
}
}
selectedExtraServices['extras-' + pets[i]] = (selectedPetKeys.join('+') || '-');
selectedExtraServices['rextras-' + pets[i]] = null;
}
}
$('#available-rooms').load('/PetBooking/GetAvailableRoomsForTimesAndDates/', {'selectedExtraServices': selectedExtraServices }, function () {
});
return false;
});
我需要将“selectedExtraServices”数组作为字符串传递给“load()”方法。我怎样才能做到这一点?
selectedExtraServices jQuery 对象如下: