title: How to convert simple form submit to ajax call;
body: <p>I have a form with input field which can be accessed like <br></p>
  
  <pre><code>var algorithm = document.forms["algoForm"]["algorithm"].value;
  var input = document.forms["algoForm"]["input"].value;
  </code></pre>
  
  <p>and earlier call was <br></p>
  
  <pre><code>document.forms["algoForm"].submit();
  </code></pre>
  
  <p>and form was<br></p>
  
  <pre><code>&lt;form name="algoForm" method="post" action="run.do"&gt;
  </code></pre>
  
  <p>It all run fine<br>
  Now I wanted convert it to the ajax call so that I can use the returned data from java code on the same page. So I used soemthing like</p>
  
  <pre><code>        var algorithm = document.forms["algoForm"]["algorithm"].value;
          var input = document.forms["algoForm"]["input"].value;
          var data = 'algorithm = ' + algorithm + '&amp;input = ' + input;
  
  
      $.ajax(
              {
                  url: "run.do",
                  type: "POST",
                  data: data,
                  success: onSuccess(tableData) 
                  { //line 75
                      alert(tableData);
                  }
  
              }
          );
  </code></pre>
  
  <p>However the above code doesn't run. Please help me make it run<br></p>