Answer the question
In order to leave comments, you need to log in
How to calculate URL for GET form?
In general, there is a form
<form action="/" method="GET" id="form">
<input type="text" name="attr" value="value">
</form>
/?attr=value
$('#form').submit (e) ->
# Как получить его вот тут?
e.preventDefault()
$('#form').submit(function(e) {
// Как получить его вот тут?
return e.preventDefault();
});
Answer the question
In order to leave comments, you need to log in
Answer here: api.jquery.com/serialize$( "form" ).serialize();
If you need exactly the whole URL, then something like this:
$('#form').submit(function(e) {
var url = $(this)attr.('action') + '/?' + $( '#form' ).serialize();
return e.preventDefault();
});
$('#form').submit(function(e) {
alert($(this)attr.('action'));
return e.preventDefault();
});
Actually why do you need it?
Maybe you want to send the form via ajax?
If so, then there is malsup.com/jquery/form
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question