Facebook FB.ui dialog problem

I have some code that brings up a facebook dialog, after the user shares they are redirected to a URL, which prompts the window to close. How do I pass on some javascript so I can display a confirmation on the current window (i.e. I want the user to be notified that they posted successfully)

I tried a simple alert but only works on the redirected page

 FB.init({appId: "APP_ID", status: true, cookie: true});

      function postToFeed() {

        // calling the API ...
        var obj = {
          method: 'feed',
          link: 'https://developers.facebook.com/docs/reference/dialogs/',
          picture: 'http://fbrell.com/f8.jpg',
          name: 'test',
          caption: 'Reference Documentation',
          description: 'Using Dialogs to interact with users.',
		  redirect_uri: 'http://domain.com/dios/index.php/response/'
        };

        function callback(response) {
          document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
		  		  
        }

        FB.ui(obj, callback);
      }

The redirect URL above just echos out: <script>self.close();</script>