图老师小编精心整理的如何在jsp中使用 jquery 的 ajax 功能希望大家喜欢,觉得好的亲们记得收藏起来哦!您的支持就是小编更新的动力~
【 tulaoshi.com - Web开发 】
$(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
来源:http://www.tulaoshi.com/n/20160219/1628396.html
看过《如何在jsp中使用 jquery 的 ajax 功能》的人还看了以下文章 更多>>
如果您有什么好的建议或者疑问,可以联系我们。 商务合作QQ:3272218541;3282258740。商务合作微信:13319608704;13319603564。
加好友请备注机构名称。让我们一起学习、一起进步tulaoshi.com 版权所有 © 2019 All Rights Reserved. 湘ICP备19009391号-3
微信公众号