I will try to make my question as simple and clear as possible. So I recently read the vs page in stackoverflow, and decided that I would start using instead . .prop().attr()prop()attr()
HTML
<form action="php/select.php" method="POST" class="ajax">
<fieldset>
<legend>Show</legend>
<div>
<input type="submit" value="Show Servers"/>
</div>
<div id="output"></div>
</fieldset>
<input type="hidden" name="action" value="SHOW_SERVERS"/>
</form>
JQuery
$(document).ready(function(){
$("form.ajax").on("submit",function(e){
e.preventDefault();
var t=$(this);
var form=t.serialize();
var method=t.prop("method");
var url=t.prop("action");
console.log(url);
});
});
The strange part comes in, when I submit this form, what it prints on the console is

My question is:
Why does jQuery return an input element and not the value of the action property of a form?
Why .prop()gets the value of a method attribute, but not an action attribute
PS: I already know that the input has a property name="action".
source
share