Welcome Guest! (App Version 3.1)

websitnero logo name

Making Service Calls

Making Service Calls in JavaScript

Making AJAX calls is a very easy method to not reload the full page and only get the content or data essential to make changes to the web page.

Following example shows the ajax call being made with jQuery and printing out result to the web page:

Example

<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>

<body>
<button id="myButton">Click Me</button>

<script>
$(document).ready(function(){
  $('#myButton').click(function(){
    $.ajax( {
      type:'Get',
      url:'myService.php',
      success:function(data) {
        alert(data);
      }
    })
  });
});
</script> 
</body> 
WebsiteNero is highly optimized for learning various website developing technlogies. We try our best to add maximum modules and examples to help learn the concepts clearly and vividly. We try to present all content and examples as simple as we can removing any complexity to hurdle easy understanding. We try best provide you with worthful content, but we cannot guarantee full correctness of all the content on this site. While using this website, you agree to have read and accepted all our terms of use and conditions, cookie, and privacy policy. Copyright, 2013-2018 by websitenero.com. All Rights Reserved.