Call web service using AJAX

In this post, we will understand how to call web service using AJAX.

Here is the code snippet to call a web service using AJAX:

<script>

       $(document).ready(function() {

               $.ajax({

                          url : ‘http://localhost:8183/api/v1/values&#8217;,

                          type : ‘GET’,

                          dataType: ‘json’,

                          success : function (data, textStatus, xhr) {

                                       console.log(data);

                          },

                         error: function(xhr, textStatus, errorThrown) {

                                        console.log (‘ Error in API CALL’);

                         }

                    });

             });

</script>

Feel free to comment to this post. You can also reach me by dropping an email to naik899@gmail.com. Thanks for stopping by !!!

Leave a Reply

Your email address will not be published. Required fields are marked *