title: How to submit a JSONRPC request using JavaScript
body: <p>I am working in a JSONRPC webservice and I am trying to send the request to the server end to get the response.
  Basically I am trying to send the following details in the request </p>
  
  <pre><code>methodname//example 899
  Language code
  Transaction code
  User ID
  Password
  number
  Amount
  </code></pre>
  
  <p>Now there is the host which I need to submit the request.If I telnet the host and the port its getting connected successfully.But when I try to submit the request through the browser I am getting some net::ERR_CONNECTION_CLOSED.I am not sure why its happening.</p>
  
  <p>I am not sure about the request that I am submitting but here is the request that I am submitting.And I am submitting request using the Javascript</p>
  
  <pre><code>&lt;Script&gt;
      JSONTest = function() {
  
  
          $.ajax({
              url : "https://domain.com:port/",
              type : 'GET',
              data : {
                  "jsonrpc" : "2.0",
                  "method" : "904",
                  "id" : "1",
                  "params": [ "en", "69", "2123129930", "4371232483", "50", "" ]
              },
              dataType : "json",
              success : function(result) {
                  //alert("result"+result[0]);
                  switch (result) {
                  case true:
                      processResponse(result);
                      break;
                  default:
                      resultDiv.html(result);
                  }
              },
          /*   error: function (xhr, ajaxOptions, thrownError) {
            alert(xhr.status);
            alert(thrownError);
            } */
          });
      };
  &lt;/script&gt;
  
  &lt;button type="button" onClick="JSONTest()"&gt;JSON&lt;/button&gt;
  </code></pre>
  
  <p>Based on the above script I am tryiing to find the answers for the following questions.</p>
  
  <ol>
  <li>Is the request that I am submitting above is valid or not ?</li>
  <li>How can I provide the URL value if the above declaration is wrong?</li>
  <li>Is the type that I have provided above is fine ?</li>
  <li>Please validate all the parameters and let me know whether all of the parameters positions as valid or not.</li>
  <li>What is the hierarchy of the parameters that I have provided above ?</li>
  </ol>
  
  <p>Really appreciate your help on this.</p>