473,320 Members | 2,146 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,320 software developers and data experts.

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 2441
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.