Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javascript send values (list of images) to php page and show the php page ? Reply To: Javascript send values (list of images) to php page and show the php page ?

#187145
__
Participant

POST is no more or less secure than GET.* They have different purposes. POST is for adding/ changing information on the server, while GET …only gets information.

* perhaps you’ve read somewhere about the danger of putting session IDs (or similar, sensitive info) in the URL? That is, indeed, not good for security, but it doesn’t have to do with the request method specifically.

If you’re asking the server to get a set of images for you, then GET is appropriate. If you’re adding new images, or updating/deleting images, then POST would be correct.

To answer your specific question, no, you can’t make a POST request using window.location. It only makes GET requests — basically the same functionality as clicking on a link or typing in the browser’s address bar.

To make a POST request, you’ll need to use a form and/or AJAX.