title: Integrating Pusher to a simple php web app
body: <p>Hello stackoverflow community, I am learning how to implement Pusher API <a href="http://pusher.com" rel="nofollow">http://pusher.com</a> into this simple web chat app. I was following a video tutorial and did every step correctly, but when I try to send a msg, it will be displayed correctly on my web browser, but will not be displayed or refreshed on another web browser. I will add my 2 php files, they are short.        </p>
  
  <pre><code>&lt;!doctype html&gt;
      &lt;html&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8" /&gt;
          &lt;title&gt;Pusher Messenger&lt;/title&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="https://js.pusher.com/3.1/pusher.min.js"&gt;&lt;/script&gt;
          &lt;script&gt;
  
          // Enable pusher logging - don't include this in production
          //Pusher.logToConsole = true;
  
          var pusher = new Pusher('your pusher key here', {
            encrypted: true
          });
  
          var channel = pusher.subscribe('channel_pusher');
          channel.bind('new_message', function(response){
            $('#sent_messages').append('&lt;li&gt;' + response.message + '&lt;/li&gt;');
          });
  
          $(function(){
              $('form').submit(function(){
                  $.post('ajax.php', { msj : $('#input_mensaje').val() }, function(response){
                      //funcion de callback
                      $('#sent_messages').append('&lt;li&gt;' + response.message + '&lt;/li&gt;');
                  }, 'json');
  
                  return false;
              });
          });
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="" methor="post"&gt;
              &lt;input type="text" id="input_mensaje" /&gt;
              &lt;input type="submit" class="submit" value="Send" /&gt;
          &lt;/form&gt;
  
          &lt;ul id="sent_messages"&gt;
              &lt;!-- Sent messages will be shown here --&gt;
          &lt;/ul&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>And this is my ajax.php file:</p>
  
  <pre><code>&lt;?php
      require('lib/Pusher.php');
  
      $options = array(
          'encrypted' =&gt; true
      );
  
      $message = $_POST['msj'];
  
      $pusher = new Pusher(
          'code provided by pusher',
          'code provided by pusher',
          'code provided by pusher',
          $options
        );
  
      $pusher-&gt;trigger(
          'channel_pusher',
          'new_message',
          array('message' =&gt; $message)
      );
  
      echo json_encode(array('message' =&gt; $message));
  ?&gt;
  </code></pre>