title: How to get ajax post request value in Go lang?
body: <p>I am working in <code>Go</code>. Following code to handle the client request.</p>
  
  <pre><code>package main
  
  import (
      "net/http"
      "fmt"
   )
  
  func main() {
    http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
      fmt.Fprintf(w, "&lt;html&gt;&lt;head&gt;&lt;script&gt;function createGroup(){var xmlhttp,number = document.getElementById('phoneNumber').value,email = document.getElementById('emailId').value; var values = {}; values.number = phoneNumber; values.email= emailId; if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}else{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}xmlhttp.open('POST','createGroup',true);xmlhttp.send(values.toString());}&lt;/script&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Group&lt;/h1&gt;&lt;input type='text' name='phoneNumber' id='phoneNumber'/&gt;&lt;input type='email' id='emailId' name='emailId'/&gt;&lt;button onClick='createGroup()'&gt;Create Group&lt;/button&gt;&lt;/body&gt;&lt;/html&gt;")
   })
   http.HandleFunc("/createGroup",func(w http.ResponseWriter, r *http.Request) {
      fmt.Println(r)
      //Try to get the user information
   })
   panic(http.ListenAndServe(":8080", nil))
  }
  </code></pre>
  
  <h3>Note</h3>
  
  <p><code>Client:</code> Contains two text box to get the <code>phone number</code>, <code>email</code> and <code>createGroup</code> button.</p>
  
  <ol>
  <li><p>If user clicks the <code>createGroup</code>, Post request of <code>/createGroup</code> is triggered using ajax.</p></li>
  <li><p>createGroup request is handled in server(Go)</p></li>
  </ol>
  
  <h3>Problem</h3>
  
  <p>How to get the phone number and email in server side?</p>
  
  <p>I have printed the request in <code>/createGroup</code> handler but values are missing.</p>
  
  <pre><code>Output: &amp;{POST /createGroup HTTP/1.1 1 1 map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8] Accept-Encoding:[gzip, deflate] Content-Length:[15] Content-Type:[text/plain; charset=UTF-8] Connection:[keep-alive] Pragma:[no-cache] Cache-Control:[no-cache] User-Agent:[Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0] Accept-Language:[en-US,en;q=0.5] Referer:[http://localhost:8080/]] 0xc200099ac0 15 [] false localhost:8080 map[] map[] &lt;nil&gt; map[] 127.0.0.1:59523 /createGroup &lt;nil&gt;}
  </code></pre>
  
  <p>Any help will be grateful.</p>