title: Jsoup for posting a form and getting response
body: <p>I'm creating an android application for myself so i can easily access my school schedule on my phone, and I am using <a href="http://jsoup.org/" rel="nofollow" title="jsoup: Java HTML Parser">jsoup</a>.</p>
  
  <p>First I'm fetching the input fields of the form i need to submit, and getting some cookies like this:</p>
  
  <pre><code>Connection.Response res = Jsoup.connect("domain.com/default.aspx")
      .userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
      .execute();
  
  cookieMap.putAll(res.cookies());
  doc = res.parse();
  
  Elements inputs = doc.select("input");
  for(Element e : inputs){
      dataMap.put(e.attr("name"), e.attr("value"));
  }
  </code></pre>
  
  <p>After this I'm trying to post the form and retrieve the data but i can't seem to get the correct html.
  I am trying this and the response html is not the page i want.</p>
  
  <pre><code>Connection.Response response = Jsoup.connect("domain.com/default.aspx")
      .data(dataMap)
      .cookies(cookieMap)
      .method(Connection.Method.POST)
      .followRedirects(true)
      .ignoreContentType(true)
      .userAgent("Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0")
      .execute();
  
  doc = response.parse();
  </code></pre>
  
  <p>I have checked the location with <code>response.url()</code> and the url is equal to <code>domain.com/showtimetable.aspx</code> which is the page you are redirected to if you submit the form normally in a browser</p>
  
  <p>All help i greatly appreciated</p>