php - Explaining an HTTP "GET" request -


i have many times implemented http "post" requests in projects, more importantly because understand how request worked in code.

now need make "get" request , bit confused on how can accomplish it.

i have html-jquery page , when launched sends "id" (post request) php server. , need php server , in database in events "id" subscribed , return events.

so need make "get" request , send parameter "id" , json file events. how php file like? mean , can write php script accepts "id" input ,makes right sql queries events , create json file them. how return html-jquery page though?

or should "get" request target xml/json files? way see described till jquery makes post request server id , server makes post request web page events. not "get" ...

there multiple ways want.

with jquery , ajax this:

$.get("yourpage.php", {id: 5}, function(jsonresult){   // whatever json result server  }); 

in "yourpage.php"

$id = $_get["id"]; //do database query etc   $result = array("yourdata" => "yourvalue")  echo json_encode($result); 

have @ http://api.jquery.com/jquery.get/ or http://api.jquery.com/jquery.getjson/

and should learn basics of http requests / responses. seems don't know doing.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -