• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javascript functions

 
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
In my program I have 2 javascript functions
function send() and function process(input)
first I have to call send() when I click a button. In this function I am calling a method which outputs a String.
ie, my send function will return me a String as Output.
Now I want to pass this String to the second function to do the rest.
How do I capture this String ?
Any code help...
Thanks,
Maya
 
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might help:
<script language="Javascript">
function Test1() {
var var1;
var1 = "Testing";
return var1;
}
function Test2(var2) {
alert(var2);
}
function Test() {
Test2(Test1());
}
</script>
:
:
<form name=form1>
<input type="button" onclick="Test()" value="GO">
</form>
 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dilip,
This is a good suggestion.
But, I am getting the var1 ( I have to get it) when I call a servlet in a remote machine.
Once I get that var1, I have to call the 2 function.
ie, in the first fn, my form's action is a servlet in a remote machine which returns me a response string.
Then I have to call the second function with this response string.. No Idea, how to do this..
Do you have any idea ?
Thanks,
Maya
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why not put your second javascript function in a second page (the target of the first page)? The second function'll compute the response string when the browser loads the second page
 
Shreya Menon
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Xavier,
Thanks for the response.
But the problem still persists.. Bcause, the terget of the first jsp is a remore servlet, actually only a class file that we have to call. I can't modify this servlet.
This is an api servlet...
Maya
 
She's brilliant. She can see what can be and is not limited to what is. And she knows this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic