Name: liliyaw Date: June 29, 2006 at 14:57:20 Pacific Subject: calling .jsp script OS: linux CPU/Ram: 524 Model/Manufacturer: don't know
Comment:
Hi everyone, Does anybody know how to call a jsp script with a value in javascript? I know there is a way to go to a different page, the syntax is window.location.replace('jobedit.jsp?id="+intItemID+"&cmd=upfb'); but I need to stay in the same window and execute the script
This article may help. It is about calling a PHP script from JavaScript without actually loading a page. Don't see why it wouldn't work for JSP as well:
Well, at this point, I'm using javascript to do POST to my request processing jsp page. The issue now - I'm ready to send back data from that jsp page into the client view page and I'm not sure what has to happen on the client side to show the data.
You want to do it asynchronously right? Only some of the content changed, not the whole page? Take a look at the 30 second tutorial written by Rasmus above, you'll get a good grasp on what should be done.
I'm not sure what has to happen on the client side to show the data
In short, the page change its content by using javascript (which is what it can do best, change things on the client side), but the content is taken from another file, as a result of a request to that file (.php file or any).
In the example page in response #2, the 'processor' outputs data in XML format, while in Rasmus' tutorial it outputs plain text with | as delimiter. string before the | is used as a marker for what div (or any) ID should change its content.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE