How to get ajax post request value in Go lang? -
I'm working in Go . The following code to handle client requests. Package main import ("net / http" "fmt") func main () {http.HandleFunc ("/", func (w http.ResponseWriter, R * http.Request) { fmt.Fprintf (w, "& lt; html> gt; & gt; head & gt; & lt; script & gt; function createGroup () {var xmlhttp, number = document.getElementById ( 'phoneNumber'). value, email = document.getElementById ( 'emailId'). value; var value = {}; values.number = phoneNumber; values.email = emailId; if (window.XMLHttpRequest) {xmlhttp = new XMLHttpRequest ();} and {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 = 'phone number' id = ' In the form, click on the button '/' CreateGroup () '& gt; Create Group & lt; / /; & gt; Input Type =' Email 'id =' emailId 'name =' emailId '/ & gt; & lt; button & gt; & lt; / body & gt; & lt; / html & gt; ")}) Actiteepikhandlifuns (" / Kreategrup "blow (and Actiteepikresponsevriter, and * Actiteepikrikvest) {Fntkprintln (R) // Try to get user information} Terror (http.ListenAndServe (": 8080", zero))}
note
Customers: There are two text boxes to get the
phone number ,
email and
createGroup buttons.
Comments
Post a Comment