0

I´m trying to change product page inside a plugin that I´m developing but I have no idea what I´m doing wrong? I have tried to make a new curl request but from what I herd curl is not a thing in WP.

what I when to a accomplish is when the user selects a new page from a dropdown a new page appears.

                <div class="col-md-6x">
                <form action="" method="POST">
                     <div class="form-group">
                        <label for="comment">Select Page:</label>
                        <select class="form-control" name="pagecall" id="pagecall" style="width:75%;float:right;" onchange="davsele(this.value);">
                            <?php
                                $totalPage = $dataget['total'] / 20;
                                for($i=1;$i<=$totalPage;$i++)
                                {
                                    $selc = ($getPageCount==$i)?'selected':'';
                                    echo "<option value=".$i." $selc>Page No. ".$i."</option>";
                                }
                            ?>
                        </select>
                    </div>
                    </form>
                    <script>
                        $(function() {
                              $('#pageBtn button').on('click', function() {
                                var index = $(this).index('#pageBtn button') + 1;
                                $('#pagecall option').eq( index ).prop('selected', true).parent().change();
                              });
                            });   
                    </script>
                    <div id="pageBtn">
                          <button><-</button>
                          <button>-></button>
                    </div>
                </div>

    function davsele(sval) {
      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
          alert(this.responseText);
        }
      };
      xhttp.open("GET", "/api.php?value=" + sval, true);
      xhttp.send();
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.