jeudi 30 juin 2016

Jquery Script To collect Distance from a Database after user enters Pickup Point and Dropoff Point in a Form


Hie Guys

I have a form here like this:

<label for="pickup">Pickup Point</label>
<input type="text" name="from" id="from" />

<label for="dropoff">Dropoff Point</label>
<input type="text" name="destination" id="destination" />

<label for="distance">Distance</label>
<input type="text" name="distance" id="distance" disabled="disabled" />

I also have a database table which is called tbl_distances which stores indexed distances between two cities like this:

Pickup_Point     Dropoff_Point       Distance

 Blantyre          Harare             800

So what i want is a script that does a live search in the table to find distance when a user enters pickup point and drop off point in the input fields. For example if one types Blantyre as pickup point and Harare as dropoff point then the distance field should be automatically field with 800.

I am an amateur at jquery. Thanks in advance.


Aucun commentaire:

Enregistrer un commentaire