2

I have a toggle button in my webpage, I submit an ajax request whenever user clicks on the toggle button, one thing is that when I refresh the page after sending the request the page tries to resubmit the request. How can I avoid this resubmission on refresh ?

I have html code as

 <div class="col-md-4">
 <input  class="toggleitem" data-onstyle="success"  checked type="checkbox"   data-toggle="toggle" >
  </div>

and jquery as
<script>

 $(function() {
        $('.toggleitem').change(function() {    

            sendrequest();
        })
    });
function sendrequest()
{
 if (confirm("do you want to continue with this request? ")) {
           $.ajax({
        url: 'https://home/systemstatus/',
        type:post,
        success: function (data) {
             console.log("success"+data);

        }
        });
}
</script>
R.Stela
  • 63
  • 1
  • 9

0 Answers0