How to simplify code, which adds spaces and commas if field value is not empty?
Firstly, I'd create a helper function for the != "" check:

function isEmptyString(value) {
    if (value == "") {
        return true;
    }
    return false;
}


It would make the code easier to read.

Then I'd extract out a function for sturctures like ($("#dob-dd").val() != "" ? $("#dob-dd").val() : "xx") + ".":

function wrapDateOfBirth(id) {
    return ($(id).val() != "" ? $(id).val() : "xx") + ".";
}


and structures like searchDetails != "" ? " "+$("#first-name").val() : $("#first-name").val();:

function wrapSearchDetails($value, $id) {
    return $value != "" ? " " + $($id).val() : $($id).val();
}


They would remove some duplication.

Furthermore, the wrapSearchDetails function could be written like this too:

function wrapSearchDetails(value, id) {
    return (isEmptyString(value) ? "" : " ") + $(id).val();
}


The wrapDateOfBirth function also could be simplified:

function wrapDateOfBirth(id) {
    var value = $(id).val();
    return (isEmptyString(value) ? "xx" : value) + ".";
}


Finally, a getDefaultIfEmpty function also could improve the readability of the wrapDateOfBirth function:

function getDefaultIfEmpty(value, defaultValue) {
    if (isEmptyString(value)) {
        return defaultValue;
    }
    return value;
}

function wrapDateOfBirth(id) {
    var value = $(id).val();
    return getDefaultIfEmpty(value, "xx") + ".";
}


(I have not tested the code, please feel free to edit if you find any typo/etc.)