Is it possible to send post-variables with javascript?
I want id
to be sent with post, not get.
window.location.href="hanteraTaBortAnvandare.php?id=10";
Is it possible to send post-variables with javascript?
I want id
to be sent with post, not get.
window.location.href="hanteraTaBortAnvandare.php?id=10";
You can use a form and then
document.getElementById('id_of_the_form').submit();
The form doesn't need to be wrote as plain HTML: you can create it dinamically:
You can use the XMLHTTPRequest() object.
The simplest way is to just have a form in your page:
Then you just post the form:
You can submit form data via JavaScript but not using window.location.href. Changing the URL location is always going to issue a GET.
You'll need to get a reference to your form from the DOM and then issue a submit() call to it.
You can do it with an Ajax-request (or use hidden forms) - in that case;
MooTools example:
jQuery example:
Of course you could do this without external libraries, but they simplify alot!