SO I have jQuery DataTables setup and running fine. My eventual goal, is to allow the user to use google places autocomplete, to update their location, and then to have a 'sortable' distance column added to my DataTables table, upon refresh.
The plan is is to have a button next to the text input of google autocomplete, that says use this address, once user searches for and finds an address using autocomplete, and then pushes the button , I want to (probably)send them to a loading page for a few seconds whilst we
1)read the text string, format it for use with google geo coding api, aka
"Cranbourne, Victoria, Australia" ----> "Cranbourne+Victoria+Australia"
2)insert it in a geocode request
3)extract the lat and lon values from the resulting json, and assign them to vars
Now comes the hard part, I was thinking using some php, to calculate the distance between the users(lat,long), and every entry that was in the DataTable table, which was was populated with sql data using a foreign key (all sql rows have lat lon data)
Then I was thinking of sending said entries to an xml, only this time every entry will have an extra value "DISTANCE".
Of coarse with some clever code this whole thing wont take a second, the new DataTable table is then populated with the xml, only this time it contains a distance column with distance values for every row, which of coarse will be sortable, without any DataTables hacks what so ever.
So am I stupid, or is this somewhat of a good idea, is there an easier way?
I would really like some answers to this thank you.