Answer the question
In order to leave comments, you need to log in
How to do something in JS by pressing a button on the form and then start the servlet?
Hello.
There was a need to do something in JS by pressing a button on the form and then start the servlet.
How is it possible to do this?
ps
tried
document.location.href="${pageContext.request.contextPath}/NewServlet";
HTTP Status 405 - HTTP method GET is not supported by this URL
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource.
Answer the question
In order to leave comments, you need to log in
managed to solve it
<form method="POST" action="InsertInDB" name="InsertInDB">
элементы формы table, input и т.д.
<button class="btn btn-infoy" type="submit" onclick="GetDefValue()"><i class="glyphicon glyphicon-inbox"></i> Сохранить</button>
</form>
<script>
function GetDefValue () {
var elem = document.getElementById("email1");
var defValue = elem.defaultValue;
var currvalue = elem.value;
if (defValue == currvalue) {
document.getElementById("demo_3").innerHTML = "Знечение не изменилось";
} else {
document.getElementById("demo_3").innerHTML = "Значение изменилось с " + defValue +
"\n на " + currvalue;
}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question