params worden niet ingeladen
alles werkt alleen bij deze foto upload geef ik parameters mee "params"
deze zijn leeg bij het versturen. de fout zit hem echt in het inladen als ik
params.lng ="test"; mee geef dan komt hij wel aan.
ik heb niet zo veel javascript ervaring en denk dat ik gewoon iets verkeerd doe met het inladen van de params.
zou iemand mij op mijn fout kunnen wijzen.
Alvast bedankt !
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
function onLocationSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />' +
'Altitude: ' + position.coords.altitude + '<br />' +
'Accuracy: ' + position.coords.accuracy + '<br />' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
'Heading: ' + position.coords.heading + '<br />' +
'Speed: ' + position.coords.speed + '<br />' +
'Timestamp: ' + position.timestamp + '<br />';
$('lat').val(position.coords.latitude);
$('lng').val(position.coords.longitude);
$.ajax({
type: "POST",
url: "http://www.addmedia-advertising.nl/app/locatie.php",
dataType: "json",
data: {
lat: position.coords.latitude,
lng: position.coords.longitude
},
success: function(item) {
element.innerHTML = "Gelukt";
var arrAddress = item.address_components;
var itemRoute='';
var itemLocality='';
var itemCountry='';
var itemPc='';
var itemSnumber='';
$.each(arrAddress, function (i, address_component) {
if (address_component.types[0] == "route"){
itemRoute = address_component.long_name;
}
if (address_component.types[0] == "locality"){
itemLocality = address_component.long_name;
}
if (address_component.types[0] == "country"){
itemCountry = address_component.long_name;
}
if (address_component.types[0] == "postal_code_prefix"){
itemPc = address_component.long_name;
}
if (address_component.types[0] == "street_number"){
itemSnumber = address_component.long_name;
}
//return false; // break the loop
});
element.innerHTML = ""+itemLocality+"<br/>"+itemRoute;
},
error: function(){
element.innerHTML = "Mislukt";
}
});
}
// onError Callback receives a PositionError object
//
function onLocationError(error) {
var element = document.getElementById('geolocation');
element.innerHTML = error.code + '\n message: ' + error.message + '\n';
}
function getImage() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto, function(message)
{
alert('U moet een foto maken anders kunnen wij u niet registeren.');
},
{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.CAMERA
}
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
var params = new Object();
params.lat = $('#lat').val();
params.lng = $('#lng').val();
params.koopman = $('#koopman').val();
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, "http://www.test.nl/app/fotoupload.php", photoUploadSuccess, photoUploadFail, options);
}
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />' +
'Altitude: ' + position.coords.altitude + '<br />' +
'Accuracy: ' + position.coords.accuracy + '<br />' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
'Heading: ' + position.coords.heading + '<br />' +
'Speed: ' + position.coords.speed + '<br />' +
'Timestamp: ' + position.timestamp + '<br />';
$('lat').val(position.coords.latitude);
$('lng').val(position.coords.longitude);
$.ajax({
type: "POST",
url: "http://www.addmedia-advertising.nl/app/locatie.php",
dataType: "json",
data: {
lat: position.coords.latitude,
lng: position.coords.longitude
},
success: function(item) {
element.innerHTML = "Gelukt";
var arrAddress = item.address_components;
var itemRoute='';
var itemLocality='';
var itemCountry='';
var itemPc='';
var itemSnumber='';
$.each(arrAddress, function (i, address_component) {
if (address_component.types[0] == "route"){
itemRoute = address_component.long_name;
}
if (address_component.types[0] == "locality"){
itemLocality = address_component.long_name;
}
if (address_component.types[0] == "country"){
itemCountry = address_component.long_name;
}
if (address_component.types[0] == "postal_code_prefix"){
itemPc = address_component.long_name;
}
if (address_component.types[0] == "street_number"){
itemSnumber = address_component.long_name;
}
//return false; // break the loop
});
element.innerHTML = ""+itemLocality+"<br/>"+itemRoute;
},
error: function(){
element.innerHTML = "Mislukt";
}
});
}
// onError Callback receives a PositionError object
//
function onLocationError(error) {
var element = document.getElementById('geolocation');
element.innerHTML = error.code + '\n message: ' + error.message + '\n';
}
function getImage() {
// Retrieve image file location from specified source
navigator.camera.getPicture(uploadPhoto, function(message)
{
alert('U moet een foto maken anders kunnen wij u niet registeren.');
},
{
quality: 50,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.CAMERA
}
);
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
var params = new Object();
params.lat = $('#lat').val();
params.lng = $('#lng').val();
params.koopman = $('#koopman').val();
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, "http://www.test.nl/app/fotoupload.php", photoUploadSuccess, photoUploadFail, options);
}
Er zijn nog geen reacties op dit bericht.