Answer the question
In order to leave comments, you need to log in
How to get a dynamically generated field with javascript?
I am writing a program in java.
I am sending a GET request. In response, a page comes with js. This page has a form. In firebug it looks like this
<form class="important" method="post" action="/do">
<button class="important" type="submit">do</button>
<input type="hidden" value="123" name="abc">
</form>
Answer the question
In order to leave comments, you need to log in
It is possible that javascript does not generate the field value itself, but receives it over the network. Look in firebug on the "network" tab for the value of this field. Don't forget to check the box "response content". If you find it, look at the query parameters and reproduce it in your program.
For pure JSvar els = document.getElementsByName('abc');
var val = els[0].value;
For jQuery
:-( Didn't enter the question right away :-(
If you get a page in your program, then you need to analyze which scripts are executed on it and which one creates this field. Then look from which source data and according to what rules the value is formed fields in the script and also calculate this value in your program.
Hidden field - this is the same field, only it is not visible.
You can get it like this $field = $_POST['abc']; the main thing is not to forget about safety
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question