title: Submitting a search in website with Jsoup
body: <p>I want to create an app that allows me to search for a city in this weather site.
  I would like you to return the site corresponding to the search performed.
  I tried to do this with an EditText and a Button, but the search does not seem to work, because the page returned is the same as the initial one.</p>
  
  <p>How can I solve this problem?</p>
  
  <p>This is my code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>final EditText editText = findViewById(R.id.edit);
          final TextView textView = findViewById(R.id.testo);
          Button button = findViewById(R.id.clicca);
          button.setOnClickListener(new View.OnClickListener() {
              Connection.Response res = null;
              Document doc;
              @Override
              public void onClick(View v) {
                  try {
                      doc = Jsoup.connect("https://www.ilmeteo.it/meteo/cerca")
                              .data("citta", "bari")
                              .post();
  
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  textView.setText(doc.location());
              }
          });</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is the site's HTML code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="search"&gt;
  &lt;a id="search-logo" href="https://www.ilmeteo.it" title="IL Meteo - Home Page"&gt;&lt;/a&gt;
  &lt;a id="search-arrow" href="javascript:;" onclick="toggleSearchMenu('main');"&gt;&lt;/a&gt;
  &lt;form id="form-search0" name="search0" action="https://www.ilmeteo.it/meteo/cerca" method="get" onsubmit="return CheckSearchForm0()"&gt;
  &lt;input id="search-main" name="citta" value="" size="17" maxlength="64" class="txtSearch" onfocus="this.className='txtSearch';openSearchMenu('main');virginSearch=false;" onblur="if(this.value=='')this.className='txtSearch txtSearchE'" title="Cerca comune o località" autocomplete="Off" tabindex="1" onkeyup="ajax_showOptions(this,'type=IT&amp;amp;sort=smart',event)" type="text"&gt;
  &lt;/form&gt;
  &lt;a id="search-button" href="javascript:;" onclick="$('#form-search0').submit()"&gt;&lt;/a&gt;
  
  &lt;div id="fav-search-cont"&gt;&lt;span id="fav-search"&gt;&lt;/span&gt;&lt;/div&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thank you all! Your answers have solved my problem :)
  But I have problems with another weather site. How do I instead from this other site do the same operation as before?</p>
  
  <p>P.S .: the problem of this site is the mandatory click of the city to search and that next to the city in the URL there is a code, like this "<a href="http://www.meteo.it/meteo/roma-58091" rel="nofollow noreferrer">http://www.meteo.it/meteo/roma-58091</a>".</p>
  
  <p>This is the second site's HTML code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="pksrc"&gt;
     &lt;form class="search-form" onsubmit="return false"&gt;
      &lt;fieldset class="icon-lens"&gt;
       &lt;input type="hidden" id="searchid" disabled="" value=""&gt;
       &lt;input type="hidden" id="searchtarget" value="_blank"&gt;
       &lt;input type="text" class="query " id="searchinput" name="search" value="" placeholder="Cerca località" autocomplete="off"&gt;
       &lt;input type="submit" value="submit"&gt;
      &lt;/fieldset&gt;
     &lt;/form&gt;
     &lt;div id="search-menu"&gt;&lt;/div&gt;
     &lt;ul id="search-option"&gt;
      &lt;li&gt;&lt;a href="/meteo/milano-15146" title="Milano"&gt;Milano&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/meteo/roma-58091" title="Roma"&gt;Roma&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="/meteo/napoli-63049" title="Napoli"&gt;Napoli&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
    &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>