Skip to main content
Arduino

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false,
 success: function (data) {
 $('#TemperaturaInterior').val(data.TemperaturaInterior).show();
 $('#TemperaturaExterior').val(data.TemperaturaExterior).show();
 }
 });
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here Here is a relevant SO question.

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false,
 success: function (data) {
 $('#TemperaturaInterior').val(data.TemperaturaInterior).show();
 $('#TemperaturaExterior').val(data.TemperaturaExterior).show();
 }
 });
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here is a relevant SO question.

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false,
 success: function (data) {
 $('#TemperaturaInterior').val(data.TemperaturaInterior).show();
 $('#TemperaturaExterior').val(data.TemperaturaExterior).show();
 }
 });
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here is a relevant SO question.

Simplified code
Source Link
Ian M
  • 121
  • 5

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/?callback=returneddata'',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false,
 });
returneddata =success: function(data) {
$('#TemperaturaInterior').val(data.TemperaturaInterior).show();
$('#TemperaturaExterior').val(data.TemperaturaExterior).show();
}
 });
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here is a relevant SO question.

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/?callback=returneddata',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false
 });
returneddata = function(data) {
$('#TemperaturaInterior').val(data.TemperaturaInterior).show();
$('#TemperaturaExterior').val(data.TemperaturaExterior).show();
}
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here is a relevant SO question.

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false,
 success: function(data) {
$('#TemperaturaInterior').val(data.TemperaturaInterior).show();
$('#TemperaturaExterior').val(data.TemperaturaExterior).show();
}
 });
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here is a relevant SO question.

Source Link
Ian M
  • 121
  • 5

This is more of a Stack Overflow question, but I'll help you a bit. The problem has nothing to do with your Arduino per-say. It has more to do with your PHP/Ajax.

Your code is suited for a completely local setup, but pulls from a remote site, which violates some security protocols build into your browser and jQuery. You need to change your code to this:

$.ajax({
 url: 'http://192.168.1.177/?callback=returneddata',
 type: 'post',
 data: { tag: 'getData'},
 dataType: 'jsonp',
 async: false
 });
returneddata = function(data) {
$('#TemperaturaInterior').val(data.TemperaturaInterior).show();
$('#TemperaturaExterior').val(data.TemperaturaExterior).show();
}
(may need slight modifications since you didn't include all PHP/html code)

For more information, see the jQuery documentation, particularly look at data types and what it says about cross-domain json vs jsonp.

Here is a relevant SO question.

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /