I am working on a cordova mobile application and I want to take all the data from a php page which displays the data in JSON and stores it in a global variable for local access.
here my JSON data:
{"success":1,"message":"Details Available!","details":[{"ID":"4","cohort_name":"Stuart Little","pin":"53870","start_date":"2014-08-02"},{"ID":"5","cohort_name":"Lexi Belle","pin":"19224","start_date":"2014-08-04"},{"ID":"6","cohort_name":"Joe Bloggs","pin":"12345","start_date":"2014-08-04"}]}
The method of which I am going to get this data is as follows:
var json = (function () {
var json = null;
$.ajax({
'async': false,
'global': false,
'url': URL goes here,
'dataType': "json",
'success': function (data) {
json = data;
}
});
return json;
})();
The problem is that I am borrowing a web server to run the backend where I pull the data from and I only have an IP address to route the ajax request to the page. Is there any other way for me to get the data and store it? Or how do I use an IP address in this kind of request?