AJAX based learning (7) - AJAX server-side script

2010-12-27  来源:本站原创  分类:Web  人气:84 

AJAX - server-side script

Now we want to create the script displays the current server time.

responseText property will store the data returned from the server. Here, we hope to return the current time. This is the "time.jsp" code:

<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setHeader("Expires","-1");
response.getWriter().write(new Date().toLocaleString());
%>

Note: Expires property sets the page cache pages are cached before the expiration of the time (minutes). -1 Indicates that the page will not be cached.

Run your AJAX applications

Below the text box, type some text, then click the Time text box:

Time text box does not load the page in the case from the "time.jsp" access to the server's time!

相关文章
  • AJAX based learning (6) - AJAX request to the server 2010-12-27

    AJAX - a request to the server To send the request to the server, we need to use the open () method and send () method. open () method requires three parameters. The first parameter defines the method used to send the request (GET or POST). The secon

  • AJAX based learning (7) - AJAX server-side script 2010-12-27

    AJAX - server-side script Now we want to create the script displays the current server time. responseText property will store the data returned from the server. Here, we hope to return the current time. This is the "time.jsp" code: <% respons

  • AJAX Advanced Learning (2) - AJAX request the source code 2010-12-27

    AJAX Suggest Example source code The following source code is the last section of the AJAX examples. You can copy and paste the code, and then personally tested it. ------------------------ AJAX HTML page This is the HTML page. It contains a simple H

  • AJAX Advanced Learning (3) - AJAX database instance 2010-12-27

    AJAX can be used to communicate with the database dynamically. ------------------------ AJAX Database Example AJAX example below, we will demonstrate how to use AJAX technology enables web pages to read information from the database. ----------------

  • AJAX Advanced Learning (4) - AJAX XML Example 2010-12-27

    AJAX can be used to interactive communication with the XML file. -------------------------- AJAX XML Example AJAX example below, we will demonstrate how to use AJAX technology, to read information from the XML file. -------------------------- Schemat

  • AJAX Advanced Learning (5) - AJAX ResponseXML instance 2010-12-27

    HTTP responseText return a string with different responses, responseXML the XML response is returned. ResponseXML property returns the XML document object, use the W3C DOM node tree methods and properties to check and parse the object. --------------

  • AJAX Advanced Learning (1) - AJAX Request Example 2010-12-27

    We have seen AJAX can be used to create more interactive applications. ------------------------ AJAX Suggest Example AJAX example below, we will demonstrate the user to a standard HTML form input data, how a web page and web servers. ----------------

  • Linux shell script based learning (1) 2010-04-17

    Source: http://os.51cto.com/art/201003/186779.htm Linux shell script based learning where we first come first lecture introduces the syntax of shell foundation, at the beginning, comments, variables and environmental variables, to tell you to do a ba

  • Linux shell script based learning (3) 2010-04-17

    Source: http://os.51cto.com/art/201003/186820.htm Linux shell script based learning about the third, in front of us shell commands and process control, the lack of space did not speak process control, process control today introduced here is only the

  • Linux shell script based learning (4) 2010-04-17

    Source: http://os.51cto.com/art/201003/186826.htm On a Linux shell script based learning, we talked about Linux shell script to control the process if, select, case, where then introduced the Linux shell script control flow of the loop and the quotat

  • Linux shell script based learning (7) 2010-04-17

    Source: http://os.51cto.com/art/201003/186831.htm Linux shell script based learning in front of this part if only look at the theory among some although there are examples, but not enough systems for everyone here will show specific examples of Linux

  • Linux shell script based learning (8) 2010-04-17

    Source: http://os.51cto.com/art/201003/186835.htm Linux shell script is to specify the instance in front of the decimal and binary conversions, but also an instance of the file loop to end this part of the study. I believe Linux shell script based le

  • Based on the ajax Jquery 2010-10-11

    <! DOCTYPE HTML PUBLIC "- / / W3C / / DTD HTML 4.01 Transitional / / EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> JQuery based on the registratio

  • On Mobile Ajax and the Frost Ajax Library 2010-11-19

    Mobile Ajax and the Frost Ajax Library OF Rocco Georgi · 2007 12 5 may This translation from the Mobile Ajax And The Frost Ajax Library Description This article describes how to create mobile websites using Ajax. The following will discuss the mobile

  • 掌握 Ajax,第 1 部分: Ajax 简介 2012-03-09

    Brett McLaughlin, 作家,编辑, O'Reilly and Associates 本文内容包括: ·老技术,新技巧 ·获取 Request 对象 ·Ajax 世界中的请求/响应 ·连接 Web 表单 ·结束语 Ajax 由 HTML.JavaScript™ 技术.DHTML 和 DOM 组成,这一杰出的方法可以将笨拙的 Web 界面转化成交互性的 Ajax 应用程序.本文的作者是一位 Ajax 专家,他演示了这些技术如何协同工作 -- 从总体概述到细节的讨论 -- 使高效的 We

  • 详细解读Jquery各Ajax函数:$.get(),$.post(),$.ajax(),$.g... 2013-07-18

    一,$.get(url,[data],[callback]) 说明:url为请求地址,data为请求数据的列表(是可选的,也可以将要传的参数写在url里面),callback为请求成功后的回调函数,该函数接受两个参数,第一个为服务器返回的数据,第二个参数为服务器的状态,是可选参数.而其中,服务器返回数据的格式其实是字符串形势,并不是我们想要的json数据格式,在此引用只是为了对比说明. 1 $.get("data.php",$("#firstName.val()")

  • 掌握 Ajax,第 1 部分: Ajax 入门简介 2014-08-27

    掌握 Ajax,第 1 部分: Ajax 入门简介 理解 Ajax 及其工作原理,构建网站的一种有效方法 Ajax 由 HTML.JavaScript™ 技术.DHTML 和 DOM 组成,这一杰出的方法可以将笨拙的 Web 界面转化成交互性的 Ajax 应用程序.本系列的作者是一位 Ajax 专家,他演示了这些技术如何协同工作 -- 从总体概述到细节的讨论 -- 使高效的 Web 开发成为现实.他还揭开了 Ajax 核心概念的神秘面纱,包括 XMLHttpRequest 对象. 查看本系列更多

  • PS based learning: Photoshop skills 167 2010-04-22

    PS based learning: Photoshop skills, Photoshop skills of 167 classic Daquan, if you are the level of the initial stage, familiar with the text and to master, immediately advanced to intermediate level. Oh definitely not advertising. Common techniques

  • ajax提交url与ajax提交表单的详细比较 2014-12-06

    本篇文章主要是对ajax提交url与ajax提交表单的区别进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助 1:ajax自已构造一个url,这种方式传参数要用Data,不能用于表单提交. 例: function createHtml(id){ $("#reloading").show(); //edit_bg是个div,提交时显示,这样可以使背景页面不能操作. $("#edit_bg").show(); $.ajax({ type: "POST&q

  • jquery的ajax全局事件和AJAX 请求正在进行时显示“正在加载” 2013-03-19

    实例 当 AJAX 请求正在进行时显示"正在加载"的指示: $("#txt").ajaxStart(function(){ $("#wait").css("display","block"); }); $("#txt").ajaxComplete(function(){ $("#wait").css("display","none&quo