title: How to catch JSON object on server side and respond back (in javascript)
body: <p>I tried to build an application <code>using Javascript, HTML, CSS, AJAX, JSON</code> in which client fill a form  and send to server , and after that server respond to client.</p>
  
  <p><strong>For this problem, I have done these steps,</strong></p>
  
  <blockquote>
    <ol>
    <li>Firstly I build a HTML page having form.</li>
    <li>Then, I send the information to javascript by using onClick event handler.</li>
    <li>Then, I build a JSON object that have form information.</li>
    </ol>
  </blockquote>
  
  <p>and the code for that is,</p>
  
  <p><strong>HTML CODE :-</strong></p>
  
  <pre><code>&lt;div id="stylized" class="myform"&gt;
              &lt;form name = "user_form" action = "operation.js" method = "post"&gt;
                  &lt;h1&gt;Sign-up form&lt;/h1&gt;
                  &lt;p&gt;This is the basic look of my form without table&lt;/p&gt;
  
                  &lt;label&gt;Name
                  &lt;span class="small"&gt;Add your name&lt;/span&gt;
                  &lt;/label&gt;
                  &lt;input type="text" name="name" id = "name_data"  /&gt;&lt;br&gt;
                  &lt;p id = "name_update"&gt;&lt;/p&gt;&lt;br&gt;
  
                  &lt;label&gt;Email
                  &lt;span class="small"&gt;Add a valid address&lt;/span&gt;
                  &lt;/label&gt;
                  &lt;input type="text" name="email"  /&gt;&lt;br&gt;
                  &lt;p id = "email_update"&gt;&lt;/p&gt;&lt;br&gt;
  
                  &lt;label&gt;Url
                  &lt;span class="small"&gt;Complete URL&lt;/span&gt;
                  &lt;/label&gt;
                  &lt;input type="text" name="url"  /&gt;
  
                  &lt;label&gt;Comment
                  &lt;span class="small"&gt;That you want to say&lt;/span&gt;
                  &lt;/label&gt;
                  &lt;textarea type="text" name="comment"  &gt;&lt;/textarea&gt;
  
                  &lt;button type="button" name = "button"  onClick="operatn(this.form)"&gt;Submit&lt;/button&gt;
                  &lt;div class="spacer"&gt;&lt;/div&gt;
                  &lt;h4 align = "center" id = "submit_update"&gt;&lt;/h4&gt;
                  &lt;div class="spacer"&gt;&lt;/div&gt;
              &lt;/form&gt;
          &lt;/div&gt;
  </code></pre>
  
  <p><strong>JAVASCRIPT CODE :-</strong></p>
  
  <pre><code>function operatn(x) {
      var name1 = x.name.value;
      var email1 = x.email.value;
      var url1 = x.url.value;
      var comment1 = x.comment.value;
      //alert(comment);
  
      var txt = '{ "details" : [ ' +
                          ' { "name_key" : "name", "name_value" : "' + name1 + '" }, ' + 
                          ' { "email_key": "email" , "email_value" : "' + email1 + '" }, ' +
                          ' { "url_key" : "url" , "url_value" : "' + url1 + '"  }, ' +
                          ' { "comment_key" : "comment" , "comment_value" : "' + comment1 + '" } ] }';
  
      var obj = eval( "(" + txt + ")" );
      //alert(obj.details[3].comment_value);
  
  }
  </code></pre>
  
  <p>But I confused in,  How to send this object to server? (tell me the
   code for that or any good link) and,</p>
  
  <p>How client establish an
   connection with server that have IP address and Port number information of server.</p>
  
  <p><strong>Help me . Thanks in advance.</strong></p>