0

I have a php page with some functions to recieve POST data, with a page refresh, no AJAX.

Right now I have a form with hidden fields that contain my dynamic data that I send with JS like so: document.my_form.submit();

Is it possible to send the data without using a form?

Basically I want to send an array of URL's from a list with thumbnails, so my function loops over the list and pushes them in arrays.

5
  • It is extremely important for the purposes of web security that a POST cannot be sent via a simple URL. Commented Oct 25, 2010 at 17:32
  • Can you explain a bit more.. These pages are behind a login system anyway, but I DO have my register page the same way. Commented Oct 26, 2010 at 6:12
  • @Pointy I'd really be interested in you clarifying this claim. stackoverflow.com/questions/4022201/… Commented Oct 26, 2010 at 9:36
  • I interpret it as follows: If a post stores data on the server, then a get should not do that too, since a simple reload of the url again would write to the server. Commented Oct 26, 2010 at 9:46
  • Things like <img> and <script> tags are allowed to have cross-domain URLs. If it were possible to make one of those URLs do a "POST" instead of a "GET" (in a way that the browser didn't know it was happening), then there'd be an unstoppable CSRF problem. Commented Oct 26, 2010 at 12:50

3 Answers 3

1

2000 characters should be ok these days:

http://www.boutell.com/newfaq/misc/urllength.html

Sign up to request clarification or add additional context in comments.

Comments

0

Nope, you can only POST data via AJAX or a form.

Comments

0

you can use get instead of post, but it sounds like the url will get pretty messy. if you aren't opposed to ajax, i would be happy to elaborate on the answer.

3 Comments

mmm, GET is not really an option as I will go over the 256 character limit.
if the urls are the same, but with some id difference , you could just send the ids, and do the url construction on the server side.
good thinking, but unfortunately my URL's are a bit random. I'll keep with the form I guess..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.