0

I'm trying to get json in my web page, but the problem is the json on 127.0.0.1:8111 and i need to use json callback. But after receiving data from localhost:8111 i'm receiving Syntax Error Unexpected symbol ':'. here is code

 var wtAPI = 'http://localhost:8111/indicators?callback=?';
$.jsonp({
                    url: wtAPI,
                    type: "GET",
                    callbackParameter: 'callback',
                    dataType: "jsonp",
                     success: function(json){
                    console.log(json)
    },
    error: function(){
        alert('error')
    }

Also tried standard

$.getJSON(...)

But this way generally not working cuz of different domains

And Here is my JSON

 {
    "valid": true,
    "speed": 70.410828,
    "pedals": -0.005646,
    "pedals1": -0.005646,
    "pedals2": -0.005646,
    "pedals3": -0.005646,
    "pedals4": -0.005646,
    "pedals5": -0.005646,
    "pedals6": -0.005646,
    "pedals7": -0.005646,
    "pedals8": -0.005646,
    "stick_elevator": 0.140294,
    "stick_ailerons": 0.000214,
    "vario": 15.953083,
    "altitude_hour": 749.124939,
    "altitude_min": 749.124939,
    "bank": 0.036605,
    "turn": -0.000850,
    "compass": 46.545422,
    "clock_hour": 9.450000,
    "clock_min": 27.000000,
    "clock_sec": 30.000000,
    "manifold_pressure": 1.330175,
    "rpm_min": 674.000000,
    "rpm_hour": 2674.219971,
    "oil_pressure": 88.618057,
    "oil_temperature": 88.618057,
    "water_temperature": 96.471817,
    "mixture": 1.000000,
    "fuel_pressure": 8.834542,
    "gears": 0.500000,
    "gears_lamp": 1.000000,
    "flaps": 0.500000,
    "trimmer": 0.170344,
    "throttle": 0.883454,
    "weapon1": 0.000000,
    "weapon2": 0.000000,
    "prop_pitch": 0.970864,
    "supercharger": 0.000000,
    "radiator": 0.974724
}
AsTex
  • 47
  • 1
  • 8
  • 1
    It doesn't look like the server is transmitting JSONP code, the resulting json should look something similar to `someMethodName({...});` Make sure the server side code is respecting the `callback` query string value. In my example, the query string would be `callback=someMethodName` – Matthew Mar 17 '15 at 20:44
  • Oh yeah, i didn't understand. But then, is there any ways to receive this json code? I need to receive this 20 times in a second – AsTex Mar 17 '15 at 20:48
  • Hopefully this stackoverflow answer will shed some light on your problem: http://stackoverflow.com/a/2887218/507793 – Matthew Mar 17 '15 at 20:51

0 Answers0