$.ajax({ context: this, type: 'post', url: '<?php echo site_url('user/accept_deny_friendship_request')?>', data: 'action='+$action+'&user_id='+$user_id, success: function(response){ //can access this now! } });