473,771 Members | 2,357 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running server side code without submitting current page?

I need to fire off some server side code, but I don't want to submit
the page I'm on. I know that's not technically possible (without
something like AJAX, maybe?). What I thought might work is to pop-up
another window (invisibly?), have it run the code, close itself and
return the results. What do you think, is it possible???

Please let me know if you have any ideas.

Thx!!!

Nov 16 '06 #1
14 1700

javelin wrote:
I need to fire off some server side code, but I don't want to submit
the page I'm on. I know that's not technically possible (without
something like AJAX, maybe?). What I thought might work is to pop-up
another window (invisibly?), have it run the code, close itself and
return the results. What do you think, is it possible???

Please let me know if you have any ideas.

Thx!!!
If all you want is to ping the server without doing anything with the
results, see this faq:

http://www.jibbering.com/faq/#FAQ4_34

Otherwise, that's what Ajax is for. By the way, in case you think you
need to "install" Ajax or something, it's not like Flash - any modern
browser (IE5+, Firefox, Safari etc.) supports the technology Ajax is
based on built-in. It won't kill you to learn how it works.

Nov 16 '06 #2
ASM
javelin a écrit :
I need to fire off some server side code, but I don't want to submit
the page I'm on. I know that's not technically possible (without
something like AJAX, maybe?). What I thought might work is to pop-up
another window (invisibly?), have it run the code, close itself and
return the results. What do you think, is it possible???

Please let me know if you have any ideas.
I've a lot :-)

You can play with a backward popup ( <body onload="opener. focus()">)
You can also play with an invisible iframe.

But more elegant is to use XMLHttpRequest (part of Ajax)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 17 '06 #3
ASM said the following on 11/16/2006 8:36 PM:
javelin a écrit :
>I need to fire off some server side code, but I don't want to submit
the page I'm on. I know that's not technically possible (without
something like AJAX, maybe?). What I thought might work is to pop-up
another window (invisibly?), have it run the code, close itself and
return the results. What do you think, is it possible???

Please let me know if you have any ideas.

I've a lot :-)

You can play with a backward popup ( <body onload="opener. focus()">)
You can also play with an invisible iframe.

But more elegant is to use XMLHttpRequest (part of Ajax)
No, the most elegant would be the one the FAQ refers to whereby you
change the .src of an image and the server side script gets fired. Why
make it harder than it has to be?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 17 '06 #4
Not sure I follow you. I don't know how to fire off the server side
script. Can you point me to the FAQ or other refs?
Randy Webb wrote:
ASM said the following on 11/16/2006 8:36 PM:
javelin a écrit :
I need to fire off some server side code, but I don't want to submit
the page I'm on. I know that's not technically possible (without
something like AJAX, maybe?). What I thought might work is to pop-up
another window (invisibly?), have it run the code, close itself and
return the results. What do you think, is it possible???

Please let me know if you have any ideas.
I've a lot :-)

You can play with a backward popup ( <body onload="opener. focus()">)
You can also play with an invisible iframe.

But more elegant is to use XMLHttpRequest (part of Ajax)

No, the most elegant would be the one the FAQ refers to whereby you
change the .src of an image and the server side script gets fired. Why
make it harder than it has to be?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 21 '06 #5
javelin wrote:
Randy Webb wrote:
>ASM said the following on 11/16/2006 8:36 PM:
>>But more elegant is to use XMLHttpRequest (part of Ajax)
No, the most elegant would be the one the FAQ refers to whereby you
change the .src of an image and the server side script gets fired. Why
make it harder than it has to be?

Not sure I follow you. I don't know how to fire off the server side
script. Can you point me to the FAQ or other refs?

We like to bottom-post in this group, to maintain the conversation
ordering. I've fixed yours for you (see how I moved your text below
Randy's?)

What Randy means with the image source is that you can use some code
like this:

------------
var myScriptCall = new Image();
myScriptCall.sr c = "/path/to/my/script";
------------

Or, in DOM terms:

------------
var myScriptCall = document.create Element("img");
myScriptCall.sr c = "/path/to/my/script";

//make it invisible but still load
myScriptCall.st yle.width = "0px";
document.body.a ppendChild(mySc riptCall);
-----------

And your script will be requested (and therefore executed).

However, since one of your requirements seems to be to "return the
results", you are much better off with XMLHttpRequest - also known
(often erroneously) as AJAX. It lets you create a javascript object
which will go off and do a background request to your web server and
return the result. Which is exactly what you want.

Do some googling on XMLHttpRequest and see if you can get yourself
started. It's not as hard as it looks. If you have trouble, come back
and ask.

Jeremy

Nov 21 '06 #6
ASM
Jeremy a écrit :
>
What Randy means with the image source is that you can use some code
like this:

------------
var myScriptCall = new Image();
myScriptCall.sr c = "/path/to/my/script";
------------

I've tried that

myScriptCall.sr c = 'script.js'

file script.js :

alert('seen');
Nothing happens ... no message box :-(

(no error in FF console)

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 21 '06 #7
ASM said the following on 11/21/2006 5:37 AM:
Jeremy a écrit :
>>
What Randy means with the image source is that you can use some code
like this:

------------
var myScriptCall = new Image();
myScriptCall.s rc = "/path/to/my/script";
------------


I've tried that

myScriptCall.sr c = 'script.js'

file script.js :

alert('seen');
Nothing happens ... no message box :-(
The .src of an Image won't execute script. If you want to load script.js
and have it executed, see this thread (or any other you can find
searching for my name and "loadJSFile " in it).

<URL:
http://groups-beta.google.com/group/comp.lang.javas cript/browse_thread/thread/145dcdbddbb7861 2/5fb5e75ca498ae6 b?lnk=gst&q=Ran dy+Webb+LoadJSF ile&rnum=4#5fb5 e75ca498ae6b>

<URL:
http://groups-beta.google.com/group/comp.lang.javas cript/browse_thread/thread/b1cee183e87aadc 2/0b637acb0115f1f 8?lnk=gst&q=Ran dy+Webb+LoadJSF ile&rnum=2#0b63 7acb0115f1f8>

The second one has a link to this page:
<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/index.html>

Can you test that page for me if you have any browsers that aren't
listed on that page? If you have a different OS but the same version
browser I would appreciate that also as there may be an OS difference in
the page.

You should get an alert when the page loads, and then clicking on the
three buttons at the top you may or may not get an alert (depending on
whether that method worked or not). OS ver, browser name and version.

Anybody else reading this that can check that page and test it in any
browser/OS not listed and let me know it would be appreciated as well.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Nov 21 '06 #8
ASM
Randy Webb a écrit :
ASM said the following on 11/21/2006 5:37 AM:
>>------------
var myScriptCall = new Image();
myScriptCall.sr c = 'script.js'

file script.js :
alert('seen');

Nothing happens ... no message box :-(

The .src of an Image won't execute script. If you want to load script.js
and have it executed, see this thread (or any other you can find
searching for my name and "loadJSFile " in it).

<URL:
http://groups-beta.google.com/group/comp.lang.javas cript/browse_thread/thread/145dcdbddbb7861 2/5fb5e75ca498ae6 b?lnk=gst&q=Ran dy+Webb+LoadJSF ile&rnum=4#5fb5 e75ca498ae6b>
That doesn't answer to my question (I know this way to do)
I'ld like to do it in JS 1.1 (JS without DOM)
The second one has a link to this page:
<URL: http://members.aol.com/_ht_a/hikksnotathome/loadJSFile/index.html>
I've saw several times this page.
And ... ?
What have I to do with it ?
Only right button works : fireFox 2, Safari 1.3.2.
No button works : iCab beta 3.0.0
All work : Opera 9.0
All browsers except NC4.5 show the first alert.
Mac OS 10.3.9

NC4.5 doesn't like id="myScriptTag "
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Nov 21 '06 #9
In comp.lang.javas cript message
<11************ *********@h48g2 000cwc.googlegr oups.com>, Mon, 20 Nov 2006
19:06:37, javelin <go************ *@spamgourmet.c omwrote:
>Not sure I follow you. I don't know how to fire off the server side
script. Can you point me to the FAQ or other refs?
>...
>--
Randy
Chance Favors The Prepared Mind
comp.lang.java script FAQ - http://jibbering.com/faq
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

You seem to be rather obtuse today.
You should read what you quote; if it's worth showing again to others,
it's worth showing to yourself first.

When you have read the FAQ thoroughly, you will know more about what you
need to do when presenting responses.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6
<URL:http://www.jibbering.c om/faq/ Old RC FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 21 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2355
by: David C. Holley | last post by:
How would I run a JavaScript function in a *.asp page and then pass the value returned to VBScript for further processing? ***Converting the function to VBScript is *NOT* an option.
6
6300
by: Jim | last post by:
I've just bought a new Windows Server 2003 and I am trying to move an exiting FrontPage website to this new machine. I can't get ASP pages to run. IIS 6.0 has been installed. From the snap-in, I have configured "Web Services Extensions" to allow CGI Extensions, ISAPI Extensions, Active Server Pages, FrontPage Server Extensions 2002, Internet Data Connector, Server Side Includes and WebDAV. All of this appears to be running fine.
5
1757
by: Hal Vaughan | last post by:
Is there a way to run a Perl script WITHOUT submitting a form? I want to be able to click an "update" button on a page and have it run a Perl script to update info, without changing the document in the browser. Is there any way to do that and leave the current page intact in the browser? Thanks! Hal
4
4502
by: earwicker | last post by:
I recently deployed a web application which contains a user registration form with the usual fields: name, address, email, password, etc. Each of the TextBoxes uses a validation control to verify the input. On my development server, this form works precisely as expected. When I deploy the app to the production server (a hosting service), the client-side validation quits working altogether. Now, I KNOW that scripts are enabled and working...
3
11124
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code behind and don't use a domain then I can not change or remove that cookie's value on the client. If I subsequently create the cookie again in the codebehind then I actually end up with TWO cookies with the same name in the response. The cookie...
22
2193
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said stage. One approach I have used on other systems is to prevent the action buttons appearing. For example, if one did not have the Role of Administrator, one would be prevented from deleting a ticket not created by oneself. However, it did occur...
3
1935
by: Jon Delano | last post by:
Hi I was wondering if it were possible to somehow stop a page from posting back to the server and running the server side code. I have a datagrid and the first column is basically a button. I have added a javascript function to the button : Dim btnView As LinkButton = e.Item.Cells(0).Controls(0) btnView.Attributes.Add("onclick", "CheckDictationMode();")
14
23170
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So, we're looking for a way to display the page with a "please wait..." message while the process is running, and then, when the process is done, update the page with the actual results/page content. We have a page that opens another browser/page...
2
1900
by: Fabio Mastria | last post by:
My application has to call a webpage with some hidden field, fill their values with some parameters and then call the submit to the form which has the action property set to a page of another web application. all of this, did via javascript. how can i send the data to fill the hidden fields to this web form? Please help me, thank you! Fabio
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.