title: How to call php function with <li> onclick event using AJAX?
body: <p>Could you help me how to call PHP function (which is calling an external server) by using AJAX if I am using  <code>onclick</code> event?</p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;h3 style=color:blue;&gt;INFORMATION &lt;/h3&gt;
  &lt;ul class="nav nav-pills" style="background-color:lightblue" &gt;
  &lt;li class="dropdown"&gt;
    &lt;a class="dropdown-toggle" data-toggle="dropdown" href="#"   style=color:blue;&gt; Information &lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
  &lt;ul class="dropdown-menu"&gt;
  &lt;li&gt;&lt;a onclick="get_inf1()" style="color:blue;cursor:pointer;"&gt;Submenu_1&lt;/a&gt;&lt;/li&gt; 
      &lt;li&gt;&lt;a onclick="get_inf2()" style="color:blue;cursor:pointer;"&gt;Submenu_2&lt;/a&gt;&lt;/li&gt; 
      &lt;li&gt;&lt;a onclick="get_inf3()" style="color:blue;cursor:pointer;"&gt;Submenu_3&lt;/a&gt;&lt;/li&gt; 
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And the called php function's begin codes are:</p>
  
  <pre><code>&lt;?php 
  function get_info1()
  {
      $bdy = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;";
      $bdy.= "&lt;soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
      xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
      xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"&gt;";
      $bdy.= "&lt;soap:Body&gt;";
      $bdy.= "&lt;GetInformation xmlns=\"http:// website  /\" /&gt;";
      $bdy.= "&lt;/soap:Body&gt;";
      $bdy.= "&lt;/soap:Envelope&gt;\r\n";
      $req = "POST /data.asmx HTTP/1.1\r\n";
  </code></pre>
  
  <p>etc ...</p>