Get more than one variables through response?

I’m creating a login script in which I get an response==“success” if everything is OK, but I also want to get the users id… Is this possible?

$.ajax({
			type: "POST",
			url: action,
			data: form_data,
			success: function(response)
			{
				if(response == 'success')
					$("#form1").slideUp('slow', function() {
						$("#message").html("<p class='success'>You have logged in successfully!</p>");
					});
				else
					$("#message").html("<p class='error'>Invalid username and/or password.</p>");	
			}
		});

THanks in advance :slight_smile:

A potentially easy way is to return -1 for a failed one, or the userid itself for a successful one.

That way you cold do something like:


var userId = Number(response);
if (userId > 0) {
    // success
    ...
} else {
    // invalid
    ...
}