Blogitter

Copy that John

Code Maniac
%
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
     <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     <html>
     <head>
     <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
     <title>Insert title here</title>
     <script type="text/javascript" src="/MyApp/js/jquery.js"></script>
     <script type="text/javascript">
         function doAjax() {
             alert('yes');
           $.ajax({
             url: 'register.html',
             data: ({name : "me"}),
             success: function(data) {
               $('#time').html(data);
             }
           });
         }
       </script>  
     </head>
     <body>
     <form action="">
     <button id="demo" onclick="doAjax()" title="Button">Get the time!</button>
     <div id="time">
     </div>
     </form>
     </body>
     </html>
	
@RequestMapping("/hello")
           public ModelAndView helloWorld() {
           return new ModelAndView("hello", "message", "Spring MVC Demo");
           }

     @RequestMapping(value = "/register", method = RequestMethod.GET)
           public @ResponseBody String registerUser(@RequestParam String name) {
             String result = "Time for registration" + name + " is " + new Date().toString();
             return result;
           }
	
<script type="text/javascript">
 $(function(){
    $('button').click(function(e){
        e.preventDefault();
        doAjax();
    })
 })


     function doAjax() {
         alert('yes');
       $.ajax({
         url: '/register/',
         data: ({name : "me"}),
         success: function(data) {
           $('#time').html(data);
         }
       });
     }
   </script>  
 </head>
 <body>
    <form action="">
 <button id="demo" title="Button">Get the time!</button>
 </form>
 <div id="time">
 </div>
%

Append

(Leave this as-is, it’s a trap!)

Only the original author or a moderator can append to this post.

Use Format Text to add links, quotes, bold, italic and more. You can also upload images or videos or archived web pages or multicontent or use any upload website.

Moderators: Blogitter Team

  1. Home
  2. » Pastebin

ABOUT :: BLOGITTER NEWS :: FEEDBACK :: MULTILINGUAL :: FORMAT TEXT :: RSS FEEDS :: REQUEST NEW CATEGORY :: REPORT ABUSE :: HELP :: TERMS OF USE :: CONTACT