因为这看起来像一个简单的web服务的答案(而不是完整的HTML页面),我会使用Ajax发送表单和管理响应。
与jQuery,这是很容易使用$.ajax
$.ajax({
url: //the URL
data: //the form value
method: //GET/POST
success: function(response){
//decode the JSON response...
var url = $.parseJSON(response).paymentLink;
//then redirect/not sure since this could be cross-domain...
window.loacation = url;
},
error: function(error){
...
}
})
的唯一想到的是,形式不应该与提交输入来送,你需要一个按钮链接到这样做Ajax调用的函数。
这可以在不JQuery的做,但我可以从内存中写入这一点;)
如果你可以编辑JSP创建响应,您可以生成一个HTML直接返回值。
window.location.href = '${paymentLink}';
Redirection ...
If nothing happend, you can click here to be redirected.
凡${paymentLink}是EL,将打印这个变量的值(以及它的服务器上的名称),以完成与URL的脚本。
一旦由客户机接收到的,它就会被执行。
当然,这不会是在每一个浏览器跨域。如果不是这样,您需要提供链接给用户使用Redirection itsefl。