473,581 Members | 2,844 Online
Bytes | Software Development & Data Engineering Community
+ 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 2465
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******@hotma il.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.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.c gi" in the tag. Then
populate the input field values manually or from JS and then use
yourformname.su bmit(); 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.javas cript,comp.info systems.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=mytablebo dy.getElementsB yTagName("tr"). item(row);
mycel=myrow.get ElementsByTagNa me("td").item(c olumn);
data=mycel.chil dNodes.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=mytablebo dy.getElementsB yTagName("tr"). item(row);
mycel=myrow.get ElementsByTagNa me("td").item(c olumn);
data=mycel.chil dNodes.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
4249
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 second form when it is called. Both forms are .htm files that call themselves when the submit button is press via the following command in each form:...
4
1774
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 the same page in the login box. I got a message of: 'HTTP 500.100 Internal Server Error'. Is this a problem of validation with POST, or just of the...
12
6534
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 and have the graph update every second without the user having to do anything like hit a refresh button. The data to plot is readily available from...
6
1614
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 files and have the information on each file posted and displayed on my form as I pragmatically manipulate that file data. I know that this simple...
3
1511
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 is posted back to the server(This is not almost welcomes by the user). I want only the part only to be refreshed or posted back(assuming that we put...
2
12540
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 <form action="display.aspx" method="post" target="_blank"> will submit the form data and open display.asp in a new browser
6
3733
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 user get used to click "enter" key to submit a form. How can I use "enter" key to submit/postback in ASP.NET. Thank, Guoqi Zheng
8
5072
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 to asp.net vb code? !--<FORM ACTION="/test/test.php" METHOD=POST>--> <form action="https://multipay.net/transaction/mpmain.php" method="post"> ...
8
3503
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 the post and get the response. using this code: Dim PostData as string Dim ActionURL as string Dim myWebClient As WebClient = New WebClient
56
7202
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 website. The issue is that I need to gauge whether a user has any items in their basket to decide which page I redirect them too. I could
0
7882
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...
0
8157
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. ...
0
8312
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7914
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8181
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...
0
6564
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...
1
5683
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2309
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
1
1410
muto222
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.