How to post a select result without a submit button using Jquery or Javascript?

Dear Experts,
How can I post below select options results to action page without a submit button?
I'm using PHP.

I think I should use JQeuery to that but I don't know how to that?
Could you please help me?

<form name="form1" method="post" action="actionpage.php">
  
<select class="form-control" name="bolge" style="max-width:350px;">
    <option value="">Select?</option>
	<option value="1">1</option>
     <option value="2">2</option>
</select>

</form>

Open in new window

LVL 1
BRMarketingAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MishaProgrammerCommented:
You can use ajax:
https://api.jquery.com/jQuery.ajax/
Some example can be like this code:
var values = 'your posted data";
$.ajax({
        url: "Yourtest.php",
        type: "post",
        data: values ,
        success: function (response) {
           // you will get response from your php page 

        },
        error: function(jqXHR, textStatus, errorThrown) {
           console.log(textStatus, errorThrown);
        }
    });

Open in new window

0
Chris StanyonWebDevCommented:
jQuery will make this a breeze. Basically, you would hook in to an event (such as when the <select> changes) and then make an AJAX request to the server, passing in the value of the <select>. Something like this:

$('[name=bolge]').change(function() {

    $.ajax({ 
        url : 'actionpage.php',
        method : 'post',
        data : { bolge : $(this).val() },
    })
    .done( function(response) {
        alert( response );
    });

});

Open in new window

This code would POST the value of your selected option to the actionpage.php script ($_POST['bolge']), and then alert whatever your script returned. There are a lot of other options for AJAX calls, and you can read the docs here -> http://api.jquery.com/jquery.ajax/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BRMarketingAuthor Commented:
thank you both
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.