Using the Joomla 2.5 login script
===

So I'm trying to login a user to Joomla through an AJAX call. Is there a login script already written that I can just pass username and password variables? Pretty much I am just looking to use the below script and want to just find the correct url to use. Is this possible?

    $('body').delegate('#login', 'click', function(e){
		e.preventDefault();
		$username = $('#username').val();
		$password = $('#password').val();
		$.ajax({
			type: 'post',
			url: 'ineedthisurl.php',
			data: {username: $username, password: $password},
			success: function(responseData){
				window.location = $url;
			},
			error: function(responseData){
				console.log('login script error');
			}
		});
	});