问题描述
脚本代码
<script type="text/javascript">
function checkStatus(){
var productid=$("#productCode").val();
var Email=$("#productEmail").val();
$.ajax({
type:'post',
data : {Email : Email},
url:'',
}).success(function(status) {
success(status);
});
}
function success(status) {
alert("data is" +status);
if (status != null && status===true) {
alert('Success');
$('#showMessage').show();
$('#showbecomepartnerMessage').hide();
} else {
alert('Error');
$('#showbecomepartnerMessage').show();
$('#showMessage').hide();
}
}
</script>
html消息代码:(我想在另一个jsp中显示)
html messages code :(which i want to display in another jsp)
<div id="showpartMessage" class="2" style="display: none;">
<h5 style="color: #1ea59e;">Email not saved</h5>
</div>
<div id="showMessage" class="2" style="display: none;">
<h5 style="color: #1ea59e;">Email is saved</h5>
</div>
我有一个ajax调用,它会返回真或假值.根据这个真或假值,我将显示和隐藏div消息.
I have an ajax call which returns me true or false value.According to this true or false value i will be showing and hiding the div messages.
我有一个jsp布局,其中将不同的jsp(组件)页面合并(集成).所以我的要求是我想从一个jsp页面向另一个jsp页面进行javascript调用,而无需打开任何新窗口.有可能吗?任何帮助将不胜感激.
I have a jsp layout in which different jsp(components) pages are clubbed(integrated).So my requirement is i want to make a javascript call from a jsp page to another jsp page without opening any new window.Is it possible??any help would be appreciated.
注意:两个jsp页面都在相同的布局内,即;用另一种jsp布局划分.
Note : Both the jsp pages are inside same layout ie; clubbed in one another jsp layout.
推荐答案
1)第一个示例
使用JavaScript函数-window.open();在单独的弹出窗口中打开JSP页面.例如:window.open(MyPage.jsp)
Opening the JSP page in a separate popup window using JavaScript function - window.open(); eg: window.open(MyPage.jsp)
2)第二个示例
<script language="JavaScript">
function updateStats(){
var jspcall="url.jsp"
window.location.href=jspcall
}
</script>
3)第三个示例
function getInput()
{
$.ajax({
type:"POST",
url: "jsp/Ajax.jsp",
data:"name=john",
success: function(success) {
}
});
}
这篇关于通过javascript调用来调用jsp页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!