Basically, I'm having a javascript file in which there is a ajax function which has its url pointing to a php file named getfile.php
.
In this php file, I'm reading and storing content of another php file with url:
http://xxx.xxx.x.xx/php/getpage.php?mode=opensvc&fx=getPositions
&date=2014-04-02
&time=0&lat=27.219722&lng=78.019616/
having data in json form to utilise in my javascript file.
I am having a problem as now I want to get the json data from php file dynamically by appending date from html input tag to getfile.php
, so that the json data will be available according to date as it will append in url to dynamically change the date attribute.
our getfile.php code is:-
$homepage =file_get_contents('http://xxx.xxx.x.xx/php/getpage.php?mode=opensvc&fx=getPositions&date=2014-04-02&time=0&lat=27.219722&lng=78.019616/');
echo $homepage;
ajax code in javascript file:-
$.ajax({
url: "getfile.php",
type: "POST",
dataType: 'json',
success: function (data) {
var i = 0;
while (data[i]) {
lat[i] = data[i].latitude;
lng[i] = data[i].longitude;
latlng1[i] = new google.maps.LatLng(lat[i], lng[i]);
}
}
});
If I change the date attribute in the url then the json data from that url is different so I want to provide the date dynamically.