如何在jsp中使用 jquery 的 ajax 功能

王朝java/jsp·作者佚名  2008-05-31
宽屏版  字体: |||超大  

$(document).ready(function() {

$("a").click(function() {

$("#decimal").val('这是一个例子');

$("#inputtext").val('控制text');

});

/*

$("a").click(function() {

alert("Hello world!");

});

*/

});

function convertToDecimal(){

$.ajax({

type: "GET",

url: "/jqueryjsp/response",

data: "key=" + $("#key").val(),

dataType: "html",

success: function(xml){

//alert( "keypress code: " + $("key",xml).text() );

/*

var decimal = document.getElementById('decimal');

decimal.value = $("key",xml).text();

//等价于上面的代码。

$("#decimal").val($("key",xml).text());

*/

$("#decimal").val($("key",xml).text());

$("#rating").html("按键代码:" + $("key",xml).text());

}

})

clear();

}

function clear(){

var key = document.getElementById("key");

key.value="";

// alert( "keypress code: " + $(this).html() );

}

jquery 在 php 中使用的例子很多,但是没有 jsp 的,

我修改了ajax on java 中的第三章的例子,应用了jquery实现了ajax

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有