Redirect to a Different View Inside of a Controller

I’m just starting to learn how to use Ionic so please bear with me. Based on data entered by a user I’m redirecting them to a different view if their login is valid. In my view I have:

<button class="button button-block button-positive" ng-click="signIn()">
    Sign In

And inside my controller I have:

$scope.signIn = function(){
    var params = 'username=' + $('#username').val();
    params += '&password=' + $('#password').val()
    $.post(url, params, function(data){
              //this part doesn't work

But the $location.url('/#/tabs/loggedin'); is wrong because it doesn’t work. Any suggestion on how to this correctly?

use $state.transitionTo()…
Look up angular ui-router help.