title: How to call the json data from web controller in Odoo
body: <p>I am trying to call the method from a controller but failed to so. I always get error that <em>createdb() has 2 arguments</em>. Any idea how to get the value of <em>db_name</em>? Please give me some examples on how to do it. Your help is highly appreciated.</p>
  <p>And this is what I did:</p>
  <pre><code>             &lt;div class=&quot;form-group form-field o_website_form_required_custom&quot;&gt;
                 &lt;label class=&quot;col-md-3 col-sm-4 control-label&quot; 
                    for=&quot;partner_name&quot;&gt;Company Name&lt;/label&gt;
                      &lt;div class=&quot;col-md-7 col-sm-8&quot;&gt;
                          &lt;input type=&quot;text&quot;
                              class=&quot;form-control o_website_form_input&quot;
                              name=&quot;partner_name&quot; required=&quot;&quot;
                              t-att-value=&quot;request.params.get('partner_name', '')&quot; /&gt;
                      &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  <pre><code>    @http.route('/cystin/createdb', type='json', auth=&quot;public&quot;, methods=[&quot;POST&quot;], website=True)
      def createdb(self, db_name):
          
          session = self._authenticate()
          if not session:
              return json.dumps(False)
  
          # create a new database
          headers = {'Content-Type': 'application/json'}
          
          create_db_url = &quot;http://localhost:8090/saas_api/create_db&quot;
          data = {&quot;jsonrpc&quot;: 2.0, &quot;params&quot;: { &quot;name&quot;: db_name } } //how to get this data?
  
          _logger.debug(&quot;Creating database...&quot;)
          r = session.post(url=create_db_url, data=json.dumps(data), headers=headers)
  
          if r.ok:
              return json.dumps(True)
          else:
              return json.dumps(False)
  </code></pre>
  <pre><code>    var session = require('web.session');
     
  
      $(function(){
          $(&quot;#trybutton&quot;).click(function()
          {
             var db_name = $('input').attr('name', 'partner_name').val();
            session.rpc('/cystin/createdb',
            {
              db_name: db_name,
            }).then(function() 
            {
              $(&quot;div.spanner&quot;).addClass(&quot;show&quot;);
              $(&quot;div.overlay&quot;).addClass(&quot;show&quot;)
            });
          });
      });
  
  </code></pre>