Friday, 28 August 2020

Post data in API

  <head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

</head> 


<h1>Device Id Send with API</h1>


<div id="result">

....

</div>


<button>Add Device Id</button>

<script>

    $(document).ready(function () {

    

       $("button").click(function(){

            

                $('#result').html("");

                 

                $.ajax({

                    type: "POST",

                    url: "http://seemacollegeparbatsar.org/api/notification",

                    data: {'device_id': 'aaaaaa1'},

                    dataType: "json",

                     

                    success: function (data) {

                         

                        

                        $('#result').append(data);

 

                    } 

                });

             

        });

    });

</script>


Full Demo : https://www.itsolutionstuff.com/post/codeigniter-3-restful-api-tutorialexample.html

Code Download : https://drive.google.com/file/d/1Xj9oTWvOFj5UrJh91BD4tKyc9gzX4XRB/view?usp=sharing

No comments: