sending data to same PHP page from Javascript, no

2019-08-17 03:06发布

问题:

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.

回答1:

2000 characters should be ok these days:

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



回答2:

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



回答3:

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.