title: How to send a dictionary with jQuery ajax and Python
body: <p>I am trying to send a dictionary using jQuery and Python. The problem is if I use async: false it works, but my goal is to send the data with async: true.
  Also, when I send the data the alert() I have in the "complete" function it's showing two times. How can I solve these two problems?</p>
  
  <p>I attach the JavaScript code and Python code:</p>
  
  <p>First the Javascript code:</p>
  
  <pre><code>arrObj = [['numero', 'dato', 'dato2'], ['12345', 'prueba', 'prueba2'], ['54321', 'abeurp', '2abeurp'], ['112233', 'trewq', 'fdsag']];
  var n = arrObj.length;
  
  for(var i=1;i&lt;n;i++){
  
      var jsonArr = {};
      jsonArr = {'numero': arrObj[i][0],
          'dato': arrObj[i][1],
          'dato2': arrObj[i][2]
          };
      jsonArr = JSON.stringify(jsonArr);
  
      $.ajax({
          data: jsonArr,
          type: 'post',
          url: '/getData',
          async: true,
          dataType: 'text',
          error: function(output){
              console.log('error');
          },
          success: function(output){
              console.log('bien ' + i);
          },
          complete: function(output){         
              alert("fin");
          }
      });
  }
  </code></pre>
  
  <p>And the Python script:</p>
  
  <pre><code>class getData(webapp.RequestHandler):
      def post(self):
          v1 = self.request.get('numero')
          v2 = self.request.get('dato')
          v3 = self.request.get('dato2')
  
          logging.info('DEBUG: var1=' + v1 + ' var2=' + v2 + ' var3=' + v3)
  
          self.response.out.write('good')
  </code></pre>
  
  <p>Thank you for your help.</p>