Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form>
- <select name="event_option" onchange="showPrice(this.value)">
- <option value=""> Wybierz opcję</option>
- @foreach ($options as $option)
- <option value="{{ $option->id }}">{{ $option->name }}</option>
- @endforeach
- </select>
- </form>
- <script>
- function showPrice(str) {
- if (str == "") {
- document.getElementById("price").innerHTML = "";
- return;
- } else {
- if (window.XMLHttpRequest) {
- // code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp = new XMLHttpRequest();
- } else {
- // code for IE6, IE5
- xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- document.getElementById("price").innerHTML = this.responseText;
- }
- };
- xmlhttp.open("GET","getprice.php?q="+str,true);
- xmlhttp.send();
- }
- }
- </script>
- <p id="price"> </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement