title: call ajax function from other page from other page
body: <p>i am working on chat application and here is my javascript code.</p>
  
  <pre><code>    function PushMessage(e , textarea) 
      {
          var code = (e.keyCode ? e.keyCode : e.which);
          if(code == 13) 
           { 
             //Enter keycode
             var text1 = document.getElementById('myTextArea').value;
             var div = document.getElementById('textmesage');
             div.innerHTML = div.innerHTML + '&lt;br&gt;' + text1;
             document.getElementById('myTextArea').value = "";
              if (text1.length !== 0) {
                  opner.sendMessage(text1);
                  event.preventDefault();
           } else {
                 alert('Provide a message to send!');
                                      }
             }
       }
  </code></pre>
  
  <p>from this upper code i want to call sendMessage(text1); ajax function from other page i also imbbed path for connection but it is not working, here is my ajax function </p>
  
  <pre><code>     sendMessage: function(message) 
            {
              alert('fakhir is jumping');
              var that = this;
              $.ajax({
              url: '/ajax/add_msg.php',
              method: 'post',
              data: {msg: message},
              success: function(data)
              {
              $('#chatMsg').val('');
              that.getMessages();
              }
              });
            }
  </code></pre>