By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,817 Members | 2,152 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,817 IT Pros & Developers. It's quick & easy.

Can JavaScript pass data via the POST method?

Expert 2.5K+
P: 4,258
I hope someone can show me the right direction for solving my problem.

I have program where a user can enter text in a <textarea>.
I want to give that user the possibility to have a pre-look at how his entered data looks at an html screen.
I want to show him that in a separate window.
So I use the JavaScript function, passing it the text-processing program and the text that the user has entered so far. For this I use the following code
Expand|Select|Wrap|Line Numbers
  1. function OpenWindow() {
  2.   var text = document.MyForm.formtekst.value.toString().replace(/\n/g ,'<br>');
  3.'disp_formtekst.php?naam=pass&v=' + text, '');
  4. }
The problem is that the maximum size for a Windows url is 2083 bytes. So when the user types more text then that amount, the string is cut-off at byte 2083.
I understand that using a POST method allows me to pass more then 2083 bytes.
My question is: can anyone point me to a solution that allows me to pass more then 2083 bytes in the function?

Thanks in advance for any suggestions.

Ronald :cool:
Sep 15 '06 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,916
Does it have to be in a separate window?

I do a similar thing but just display the text in a div, I use the onchange handler to update the div as the user types.

If it does have to be in a separate window then can you

Open the Window without putting the text on the url
Use Javascript and the returned value of to write the text directly to the body of new window.

P.S. Hey you're an expert you're meant to know everything already :D
Sep 15 '06 #2

Expert 2.5K+
P: 4,258
Yes it has to be a separate window and I have to pass the data to the text-formatting (disp_formtekst.php) routine.
It works perfectly well as long as the data in the GET does not exceed 2083 bytes (the Windows GET string limitation).
Using CURL is no option, because there is no JS-CURL binding.

That is why I asked if there would be a way to POST the data via JavaScript.

Ronald :cool:
Sep 16 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.