Tuesday, 17 September 2013

HTMLUnit : Send AJAX Post request

HTMLUnit : Send AJAX Post request

I'm using HTMLUnit to get a webpage that contains javascript. In this
webpage, I have a form, that help user input some information, and will
send ajax to server and change some contents of page. For example. The
Form is :
<form name="ajaxform" method="post" onsubmit="return checkDate();">
<label>Data1</label>
<input name="data1" id="data_1" readonly="readonly" / type ="text"
value="">
<label>Data2</label>
<input name="data2" id="data_2" readonly="readonly"/ type ="text"
value="">
<input name="getData" value="Get All Data From Server" / type
="submit" value="">
</form >
So my question is : How can I send a post request for this form to server.
(use pure java or HTMLUnit), and how can I get modified page, after server
return data again back to client.
Thanks :)

No comments:

Post a Comment