473,378 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

POSTing without a form?

Ah, new question =) (Well, half-new, I asked something similar a while ago,
but disregarded the question myself)

Is there any way to post data to Javascript in a new page without using a
form or, alternatively, to dynamically construct a "virtual" form object
(such as new Form();) and submit it?

Thanks in advance,
Daniel

--
There are 10 kinds of people: Those who know binary and those who don't.
Jul 20 '05 #1
8 7245
Daniel wrote:
Ah, new question =) (Well, half-new, I asked something similar a while ago,
but disregarded the question myself)

Is there any way to post data to Javascript in a new page without using a
form or,
It seems you mean something like:

oNewWin = window.open(...)
oNewWin.document.write(...)

Your phrase "post data to Javascript in a new page" is both confused and
confusing to me. Post is a type of request (a "request method") that
goes to a web server. The web server takes the request and does
something with it -- "post" usually means the request is turned over to
a specified process to run, with the result of that process (most of the
time) returned to the originating client or causing some change at the
server (or both). Sometimes what is returned may cause a new
browser-window to open and display content at the client, but you don't
really "submit to another window" or "post to Javascript".

For the data to go anywhere, you *must* use a form. Hmmm... someone will
point out exceptions (HTTPRequest); but basically in HTML, if you want
to the data to go anywhere, you must use a form. And the form elements
containing the data you want to send must be within the <form></form>.

You can create the new window and content without any submitting
anything at all--just by using the window.open() and document.write()
methods listed above.

alternatively, to dynamically construct a "virtual" form object (such as new Form();) and submit it?

There are probably several ways of dynamically creating a form: using
createElement('form')and adding the necessary attributes, children, etc;
using "innerHTML"; or in certain circumstances using documet.write().
Also, don't forget the possibility of using the HTTPRequest approach
(there have been some fairly recent posts on this).

Watch out for wrapping of long url's...

http://groups.google.com/groups?hl=e....de%26rnum%3D1
http://groups.google.com/groups?hl=e....de%26rnum%3D1

Regards,
Stephen
Thanks in advance,
Daniel


Jul 20 '05 #2
You can't POST between pages on the client-side, so you'll have to use GET.
Just create a querystring and append to the next URL.
Parse the "location" in the next page to retreive the info.
or use frames
or use cookies

tim
"Daniel" <so************@i-get-virus-and-spam.com> wrote in message
news:3f***********************@dread12.news.tele.d k...
Ah, new question =) (Well, half-new, I asked something similar a while ago, but disregarded the question myself)

Is there any way to post data to Javascript in a new page without using a
form or, alternatively, to dynamically construct a "virtual" form object
(such as new Form();) and submit it?

Thanks in advance,
Daniel

--
There are 10 kinds of people: Those who know binary and those who don't.

Jul 20 '05 #3

"Stephen" <ss*****@austin.rr.com> wrote in message
news:P2********************@twister.austin.rr.com. ..
Your phrase "post data to Javascript in a new page" is both confused and
confusing to me. Post is a type of request (a "request method") that
goes to a web server. The web server takes the request and does
something with it -- "post" usually means the request is turned over to
a specified process to run, with the result of that process (most of the
time) returned to the originating client or causing some change at the
server (or both). Sometimes what is returned may cause a new
browser-window to open and display content at the client, but you don't
really "submit to another window" or "post to Javascript".
Sorry, I should've just said "post" - the data will be used by a Javascript
script in a new page, but that doesn't really matter... But I do mean post,
because posted/form-submitted data is sent through HTTP headers, eliminating
the possibility of hitting URL length barriers, and I have quite a lot of
data to send ;)
There are probably several ways of dynamically creating a form: using
createElement('form')and adding the necessary attributes, children, etc;
using "innerHTML"; or in certain circumstances using documet.write().
Also, don't forget the possibility of using the HTTPRequest approach
(there have been some fairly recent posts on this).


I'm gonna check out both createElement and the HTTPRequest thing and see
what I can find.

Thanks for the help, Stephen =)

Daniel

--
There are 10 kinds of people: Those who know binary and those who don't.
Jul 20 '05 #4

"Daniel" <so************@i-get-virus-and-spam.com> wrote in message
news:3f***********************@dread12.news.tele.d k...
Sorry, I should've just said "post" - the data will be used by a Javascript script in a new page, but that doesn't really matter...


Sloppy fingering here, it should've read "PHP constructed Javascript script"
:)
Jul 20 '05 #5

"Tim Williams" <sa************@THISpacbell.net> wrote in message
news:AG***************@newssvr19.news.prodigy.com. ..
You can't POST between pages on the client-side, so you'll have to use GET. Just create a querystring and append to the next URL.
Parse the "location" in the next page to retreive the info.
or use frames
or use cookies

tim


My mistake, I should've written that the data will be collected by a PHP
script that creates Javascript. Sorry =)
Jul 20 '05 #6

My mistake, I should've written that the data will be collected by a PHP
script that creates Javascript. Sorry =)


You can create a GET querystring like this:
<a href="file.php<? if($data) echo '?data='.$data; ?">

or POST via a form with hidden fields:
<form method="post" action="file.php">
<input type="hidden" name="data" value="<? echo $data; ?>">
</form>

I don't think that there are other possibilities.

HTH

--
Markus
Jul 20 '05 #7

"Stephen" <ss*****@austin.rr.com> wrote in message
news:P2********************@twister.austin.rr.com. ..
For the data to go anywhere, you *must* use a form. Hmmm... someone will
point out exceptions (HTTPRequest); but basically in HTML, if you want
to the data to go anywhere, you must use a form. And the form elements
containing the data you want to send must be within the <form></form>.


Been looking into XML HTTPRequest, it fits my requirements exactly, and the
IE/Mozilla requirements impose no problems, so YAY!! =)

Thanks!
Daniel


--
There are 10 kinds of people: Those who know binary and those who don't.
Jul 20 '05 #8
Hi,

So how did you did it? Can you give me an example?

Thanx,

Thoaren
Apr 11 '06 #9

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

Similar topics

9
by: Dave Martin | last post by:
I've successfully used CURL to maneuver around and through sites but a new site I've been trying to work with has got me stumped. To retrieve the data I'm trying to get a login is required. If...
10
by: DaveFash | last post by:
Posting variables from an HTML FORM, via the Request.Form function on the receiving ASP page is great. But how can you POST a Form variable to an ASP page -- without a human pushing a Submit...
2
by: Esa | last post by:
Hi, I'm having problems with one strange web system where submitting an application and making queries about its handling status require a series of form submits and response parsing - all in...
2
by: Peter2 | last post by:
Hi, I have a problem posting non-ASCII characters in FORM fields between classic ASP and ASP.NET. I use a fully patched Windows 2000 Advanced Server with .net 2.0 and visual Studio 2005 installed,...
6
by: tony | last post by:
Is it possible to use the post method to send a form from PHP without having to put the form in a html page? <form action="https://www.mysite.com/cgi/incoming.php" method="post"> <input...
2
by: Alan Silver | last post by:
Hello, I have just discovered that if you turn off Javascript, then cross-page posting does not work. The postback goes to the originating page, which basically means that nothing happens. I...
4
by: Peter Afonin | last post by:
Hello, I have a form with several buttons, and I need to post this data to several different applications. In ASP.NET 1.1 it was quite easy - I just used HTML controls (text or hidden), then...
17
by: Johnny BeGood | last post by:
Hi All, Is there a way to post the contents of a form without having to click on the Submit button, i.e <form method="post" action="http://www.whereever.com/ProcessTheData.php"> <INPUT...
1
by: gnawz | last post by:
Hi guys, I have a couple of php files that perform various tasks. I will use fields in my system and provide code as well I need help as follows: My database contains the fields Category...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.