473,473 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Post data to server from javascript on client side

Hello everyone,

I have a few values and variables that I want to post to a server
(without using a SUBMIT button). Is there a way to post data from
within javascript - do sockets or connections have to be open for this
to work?

Any help, hints or advice is appreciated :-)

Kindest Regards.

Jul 23 '05 #1
5 2450
If you can stick with Mozilla support only, you could use JS Connect.
From what I remember, it allowed for direct connection between

JavaScript on a client to an app on the Server.

Personally I've never tried using JS Connect as I, unfortunately, must
support IE as the primary browser.
JsD
[Happily building IE deployed apps with Mozilla]

Jul 23 '05 #2
Do you really mean POST (as opposed to GET), or just "send".

To send values via a GET you could create an image in js and assign a
URL containing your (suitably encoded) values to its src.
Or use the (XML)HTTP request object (activex in IE and buil-in in NS
IIRC) to GET or POST.
http://jibbering.com/2002/4/httprequest.html
Or use remote scripting (google for this and you should find at least
one relatively cross-browser implementation).

Tim.

"milkyway" <d0******@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hello everyone,

I have a few values and variables that I want to post to a server
(without using a SUBMIT button). Is there a way to post data from
within javascript - do sockets or connections have to be open for
this
to work?

Any help, hints or advice is appreciated :-)

Kindest Regards.

Jul 23 '05 #3

milkyway wrote:

Hello everyone, I have a few values and variables that I want to post to a server
(without using a SUBMIT button). Is there a way to post data from
within javascript - do sockets or connections have to be open for this
to work? Any help, hints or advice is appreciated :-) Kindest Regards.


What prevents you from having a (named) form on your page with properly
setup action="http://yourhost.com/yourreceiving.cgi" in the tag. Then
populate the input field values manually or from JS and then use
yourformname.submit(); when you're done?
If you want the original page to stay on the same URL, you can just make
the form open a new window, which, when fully loaded, will close itself.
Gotta be careful with popups after the Win XP SP2 though - could easily be
disabled on the customer's PC. Can always submit the original page and
then redirect it back if popup is a problem.
Sincerely,
Dmitri
http://www.1-script.com/install/
Check out my CGI scripts installation offer
-------------------------------------


##-----------------------------------------------#
Article posted with Web Developer's USENET Archiv
http://www.1-script.com/forum
no-spam read and post WWW interface to your favorite newsgroup -
comp.lang.javascript,comp.infosystems.www.authoring.html - messages and counting
##-----------------------------------------------##
Jul 23 '05 #4
Hello again everybody,

Grant asked me to say what my goal is soooo here it goes (actually, I
thought I had posted it a short while ago but it does not look like my
new info made it out to the network).

Basically, I have a table on the HTML page that one can add rows to
dynamically. After rows are added, I want to save the contents of the
table to the server and eventually to be saved to a database. I have
found that by using the statements below, I am able to get the data out
of the cell:

myrow=mytablebody.getElementsByTagName("tr").item( row);
mycel=myrow.getElementsByTagName("td").item(column );
data=mycel.childNodes.item(0).data;

Now I just need to send it to the server. I was doing further search on
the net and saw that hidden fields can be used - but - how does one add
hidden fields (dynamically) to a form? Also, in addition to the "hidden
fields" solution, there is a one that uses a "query string" - at least
that is what they say on this page here:

http://forums.devshed.com/archive/t-16003

Which approach is better - hidden fields or query string and (as asked
above) if hidden fields are better, how does one add them dynamically
to a form?

Regards,
Milkyway

Jul 23 '05 #5
Hi once more,

Here is a link where one is adding the parameters to an action
attribute of a form.

Regards.

http://groups-beta.google.com/group/...11be38a6dfce90
milkyway wrote:
Hello again everybody,

Grant asked me to say what my goal is soooo here it goes (actually, I
thought I had posted it a short while ago but it does not look like my new info made it out to the network).

Basically, I have a table on the HTML page that one can add rows to
dynamically. After rows are added, I want to save the contents of the
table to the server and eventually to be saved to a database. I have
found that by using the statements below, I am able to get the data out of the cell:

myrow=mytablebody.getElementsByTagName("tr").item( row);
mycel=myrow.getElementsByTagName("td").item(column );
data=mycel.childNodes.item(0).data;

Now I just need to send it to the server. I was doing further search on the net and saw that hidden fields can be used - but - how does one add hidden fields (dynamically) to a form? Also, in addition to the "hidden fields" solution, there is a one that uses a "query string" - at least that is what they say on this page here:

http://forums.devshed.com/archive/t-16003

Which approach is better - hidden fields or query string and (as asked above) if hidden fields are better, how does one add them dynamically
to a form?

Regards,
Milkyway


Jul 23 '05 #6

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

Similar topics

5
by: TG | last post by:
Dear PHP Group, I have two forms that are used to collect user information. The first one takes user inputted values such as fullname, city, address etc. I want these values to display in the...
4
by: GEO Me | last post by:
I have read a few comments against doing validation using JavaScript, and when I found a page that seems to do validation using POST I wondered what would happen if I pasted a long sentence from...
12
by: Russ | last post by:
I'm interested in setting up a web page where live data can be displayed in real-time on the web page. For example: I would like to display a (nice looking) graph of some data value versus time...
6
by: Paul Perot | last post by:
Hi All: I was wondering if it was possible to evoke a post back event during code execution. I have a form that contains file specific information. I would like to iterate through an array of...
3
by: Ahmed Hashem | last post by:
Hi All; I hope that you can help me in replying to my question. I have a web form that have many post backs to get data from the web server. Every time I use one of those post backs all the page...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
6
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many...
8
by: Gert | last post by:
Hi, I have a form (server side) because of the filling of variables through the application. But now I need to post it to an url on submit. My .HTML form looks like this, but how to translate it...
8
by: Laith Zraikat | last post by:
I am trying to invoke a post request from code behind of an asp.net page using "WebClient" object, and I want the user to be redirected to the action url as well. So far Ive been able to send...
56
by: UKuser | last post by:
Hi, I'm not sure if this can be done as I've searched the web and this forum. I am using an online merchant provider and I must post certain variables to their webforms through a form on my...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.