Just the part that says 'this works, but this doesn\'t'! Don't understand why the alert gives the data back (so the AJAX is fine) but the error handling doesn't work properly. Any suggestions?

HTML Code:
$(document).ready(function() {
	$("#sit_date").datepicker();
	$("select[name='usertype']").change(function() {
		if($(this).val()=="0") {
			$(".indv").slideUp(500);
			$(".comp").slideDown(500);
		} else {
			$(".indv").slideDown(500);
			$(".comp").slideUp(500);
		}
	});
	$("input[name='marka'],input[name='markb']").bind("keypress paste keyup  blur focus", function() {
		var marka = $("input[name='marka']").val();
		var markb = $("input[name='markb']").val();
		var perc = (marka/markb)*100;
		if(perc>0 && perc<=100) {
			$("#per").html(Math.round(perc));
		} else {
			$("#per").html("");
		}
	});
	$("input[name='vcode']").bind("keypress keyup paste blur focus", function() {
		$.post("include/ajax.php", { type: "checkVoucher", vcode: $(this).val() }, function(data) {
			$("input[name='group']").val(data);
		});
		$.post("include/ajax.php", { type: "checkType", vcode: $(this).val() }, function(data) {
			$("input[name='certificates']").val(data);
		});
	});
	
	
	/*
	//fix for fast typing/duplicate results with time() as request number
	var latestRequestNumber = 0;
	$.ajax({
		type: "POST",
		url: "include/ajax.php",
		data: {company : serchval, requestNumber: ++latestRequestNumber},
		success: function(data) {
			var results = (JSON.parse(data));
			if (results.requestNumber < latestRequestNumber) return;
			// ... otherwise, display results from this response ...
		}
	});
	*/
	
	
	$("input[name='wbn']").bind("keypress keyup paste blur focus", function() {
		$.post("include/ajax.php", { type: "getAssessment", wbn: $(this).val() }, function(data) {
			if(data!="") {
				$("select[name='assessment']").html(data);
			}
		});
	});
	
	$("input[name='manual_add']").click(function() {
		var list = "";
		var error=0;
		if($("input[name='fname']").val() == "") {
			list = list + "<li>The first name field is blank</li>";
			error++;
		}
		if($("input[name='lname']").val() == "") {
			list = list + "<li>The last name field is blank</li>";
			error++;
		}
		
		var wbn = $("input[name='wbn']").val();
		if(wbn == "") {
			list = list + "<li>The workbook number field is blank</li>";
			error++;
		} else {
			$.post("include/ajax.php", { type: "workbookNumber", wbn: wbn }, function(data) {
				alert("This result works: " + data);
				list = list + "<li>This result doesn't work:" + data + "</li>";
				error++;
				/*
				if(data=="duplicate") {
					$(".alert").slideDown(500);
				} else {
					list = list + "<li>" + data + "</li>";
					error++;
				}
				*/
			});
		}
		
		if($("select[name='usertype']").val() == 0) {
			if($("input[name='vcode']").val() == "") {
				list = list + "<li>The voucher code field is blank</li>";
				error++;
			} else {
				$.post("include/ajax.php", { type: "findVoucher", vcode: $("input[name='vcode']").val() }, function(data) {
					if(data == "none") {
						list = list + "<li>The voucher code does not exist</li>";
						error++;
					}
				});
			}
		}
		
		
		/*
		if($("input[name='wbn']").val() != "") {
			list = list + "<li>The workbook number field is blank</li>";
			error++;
		} else {
			$.post("include/ajax.php", { type: "checkUsed", wbn: $("input[name='wbn']").val() }, function(data) {
				alert(data);
					list = list + "<li>"+data+"</li>";
					error++;
				if(data == "none") {
					list = list + "<li>The workbook number does not exist</li>";
					error++;
				}
				var arr = data.split('/');
				
				//problem here?
				if(arr[0] != "0" && arr[2] != "0000-00-00 00:00:00") {
					
					list = list + "<li>The workbook code has already ben used.</li>";
					error++;
					$.post("include/ajax.php", { type: "checkNames", userid: arr[0], type: arr[1], fname: $("input[name='fname']").val(), lname: $("input[name='lname']").val() }, function(data) {
						if(data == "") {
							list = list + "<li>The workbook code has already ben used.</li>";
							error++;
							if(arr[1] == "0") {
								list = list + "<li>This workbook number has been used by an online assessment user. If this is another attempt, please ensure the first and last names are correct.</li>";
								error++;
							}
							if(arr[1] == "1") {
								list = list + "<li>This workbook number has already been used by a manual assessment user. If this is another attempt, please ensure the first and last names are correct.</li>";
								error++;
							}
						} else {
							// work out what you're gonna do with the duplicate
							// this workbook number has already been used, is this a duplicate or not? popup window thing... maybe if error==0, then test to see if the user exists with the same name and ask for duplicate with different box...
							$(".alert").slideDown(500);
						}
					});
				}
			});
		}
		*/
		
		if(($("input[name='questions']").val() == "") && ($("input[name='marka']").val() != $("input[name='markb']").val())) {
			list = list + "<li>The questions wrong field is blank</li>";
			error++;
		}
		
		if(error>0) {
			$(".error").slideUp(500);
			$(".jquery-error ul").html("").append(list);
			$(".jquery-error").slideDown(500);
		} else {
			$("form").submit();
		}
	});
});