使用jQuery Ajax打开不同的jsp [英] using jquery ajax to open a different jsp
本文介绍了使用jQuery Ajax打开不同的jsp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的情况:多个jsp页面都包含字段,并且用户在单个页面上填写了所有字段后,他们单击下一步"按钮转到下一页.我需要将下一个jsp加载到窗口中.
Heres my scenario: multiple jsp pages all with fields and after a user has filled in all fields on a single page they click a "next" button to go to the next page. I need to load in the next jsp into the window.
如何使用jquery ajax做到这一点?
How using jquery ajax can I do this?
这是我的代码.
$(document).ready(function(){
$(document).ready(function(){
$("#btnSubmit").click(function(event){
$.ajax({
type: "GET",
cache: false,
url: "Request.jsp"
});
});
预先感谢
推荐答案
添加:
$(document).ready(function(){
$("#btnSubmit").click(function(event){
$.ajax({
type: "GET",
cache: false,
url: "Request.jsp"
success: function(data){ window.location="/Page.jsp"});
});
});
此处将ID为"response"的"Request.jsp"数据加载到div中
Here you load "Request.jsp" data in to div with id "response"
如果要加载其他jsp文件,则可以使用load()函数.
If you want to load other jsp file you can use load() function.
类似这样的东西:
<input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)">
<input type="button" value="Go to Next Page" onClick="javascript: history.go(+1)">
这篇关于使用jQuery Ajax打开不同的jsp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文