I am trying to understand the following line from a website source code:
$.post("/cp/gallery_items/upload_handler/", { file_name: file.name, file_size: file.size, in_element_id: "20144" } , function(data){ ... });
After searching many days online I can assume:
"/cp/gallery_items/upload_handler/" - name of script that will process the request (not sure how to see the script code. When I go the the website I get a blank screen including no source script to examine)
file_name, file_size, in_element_id - unique keys that are somewhere defined. (I tried replacing file_name with filename or file_names and request got no results).
file_name - name of the file to be uploaded.
the upload script returns "data", which is used later.
I have no clue where this post request is sent. I was figuring the script would somewhere mention the unique keys: file_name, file_size, in_element_id. But I can't find it mentioned anywhere.
Many thanks in advance.
Great question. You cannot see php nor post-handling code from the client-side (browser). It is executed on the webserver and usually stored in a database. https://en.wikipedia.org/wiki/Server-side_scripting
POST unlike GET is a request method which has data enclosed in it. POST request is a request to a server to accept the data enclosed by the body of request message. It's mainly used to store/send data to server usually files or forms data.