-3

In a JSP I want to perform an call to another JSP after the form has been submitted and I cannot use action attribue as it already being used?

I want to call another JSP with above limitations.

tried using jquery

 ">"  $('#form2').submit(function(event) { $.ajax({  ">"

but didnt work..

4

1 回答 1

0

您可以使用以下方式来做到这一点

将此代码附加到任何事件,如 onclick

function post(){
 //Get your form inputs
 var myID = $("#myID ").val();
 var myName = $("#myName").val();

 //post your data
 var request = $.ajax({
    url: "thepagewhichhasform.jsp",
    type: "POST",
    data: {id : myID , name : myName },
    dataType: "html"
 });

 //When post is completed
 request.done(function(msg) {
     //change the page
     window.location.href = "theotherpage.jsp";
 });

 return false;
 }
于 2012-07-24T06:22:32.287 回答