Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to run a javascript then trigger perl

Status
Not open for further replies.

Nutthick

MIS
Jan 14, 2004
126
0
0
GB
I have a web interface that uses javascript to create a modal window, allowing the user to enter new data. What I want to do is refresh the parent page with the newly added data, when the user clicks OK on the modal.

The parent page is generated with perl, as it has to read the contents of a directory, so the only way I can think to do it, is to trigger the perl with the javascript when it's done, but it sounds messy.

Does anyone know how to do what I need, either how I think it will have to work, else a cleaner method?

Thanks
 
When you submit the new data on the modal window, redirect the parent window browser to your perl script url and pass the new parameters with get on the url or with post hidden in the modal window's html.
It is not that messy to redirect a browser to the same url with javascript, is it?


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Hi,
Hoping that you just need to "trigger" the perl script( and not get any response from it), you can use the following javascript.

Code:
<script>
var img = new Image;
function allDone()
{
img.src = "[URL unfurl="true"]http://domain.com/cgi-bin/perl.cgi?name=san&more=1&rand="+Math.random();[/URL]
}
allDone();
</script>

though not reqd, but your perl script should after processing the request, redirect to "blank.gif".

HTH,
San

---
cheers!
san
smoking3vc.gif


print length "The answer to life, universe & everything!
 
Thanks for the replies. I haven't had a chance to try them yet as I've got stuck just before that point :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top