I'm a newbie to the things like PHP, HTTP request and JSON response. So, please help me.
I've an HTML form as follows :
<form>
<div id="link2" style="float:left; width:320px; margin:10px 115px 20px 55px; border:1px solid #ccc; border-radius:5px;">
<p style="font-size:20px; padding:20px; text-align:center; font-family…'Trebuchet MS', Arial, Helvetica, sans-serif; color:#014464;">
Track your shipment
</p>
<input id="input" type="text" style="float:left;" placeholder=" Enter your shipment number"></input>
<button class="btn btn-primary" style="width:45px; margin-left:0px; border-top-left-radius:0px; border-bottom-left-radius:0px; padding:0px 0px;" value="">
<img width="32" height="32" src="image/go.png"></img>
</button>
</div>
</form>
Now when user will enter some value in a input text field(id="input"), submits the form then an HTTP request should get generate to fetch the data in JSON format.
For it following is the URL :
http://54.169.89.151/ShipmentTracking/Service1.svc/GetStatusJson?HBLNo=TESTHBL/23
Currently, if I hit this URL in the browser I get data in JSON format in my browser window.
The parameter HBLNo is nothing but the value entered by user in an input text field(id="input") which would append to the above URL as a query string upon form submission.
How should I make this happen through PHP code that user enters some data in a input text field, submits the form, the HTTP request gets generate, the JSON data receives, parse the JSON data and put it in a decent UI format which is responsive in nature.
The UI page showing results should be responsive on Mobile/Tablet device browsers as well.
Can someone please help me in this regard?
Thanks in advance.