Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

http request on event with (jQuery?)

I have a select form, with a few option values, and I want the page to reload when someone selects another option value, without having a submit button that is. Just reload the page when someone change the value. I would like to skip fetching the data with an AJAX request. So the idea here is to call a HTTP-request when the option value is changed. I thought jQuery would be a nice way to do this, but maybe there's another way.

So the question is;

How do I call a HTTP request in the event of someone changing the value in a select form without a submit-button?

like image 249
Stefan Konno Avatar asked Mar 19 '26 01:03

Stefan Konno


1 Answers

$('#selectId').change( function(){
  document.location.href = '/newUrl';
});
like image 89
redsquare Avatar answered Mar 21 '26 14:03

redsquare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!