render POST response - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:ajax

Description

render POST response

Demo Code

ResultView the demo in separate window

<html>
 <head></head> 
 <body> 
  <div id="content"></div> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js"></script> 
  <script>
    $.ajax// w ww  . j av  a2s. co  m
    ({
        type: "POST",
        url: "http://localhost:8080/example",
        data: { messageid: 1},
        dataType: "json",
        cache : false,
        success: function (data) {
            $('#content').text(data.message);
        },
        error: function (err) {
          console.log(err);
        }
    });
    
      </script>  
 </body>
</html>

Related Tutorials