0
$(document).ready(function () {
    var oOpenOrders = new Array();
    $('#btn').click(function () {
        $.ajax({
            type: 'GET',
            url: 'http://192.168.19.22/test.php',
            contentType: "application/json; charset=utf-8",
            dataType: 'json',
            success: function (data) {
                debugger;
                for(var i=0; i<data.length; i++){
                    alert(typeof(data.id));
                    oOpenOrders.push(data);
                }
               var obj = jQuery.parseJSON(data);
               debugger; 

this code snippet i am using and want to parse it(want to use lat, long) even data.length say correct length 4 for following json, following json is coming from ajax call.:

[{"id":"3037","latitude":"28.617422000","longitude":"77.381180000"},
 {"id":"3036","latitude":"28.617422000","longitude":"77.381180000"},
 {"id":"3035","latitude":"28.617422000","longitude":"77.381180000"},
 {"id":"3034","latitude":"28.617422000","longitude":"77.381180000"}]

any idea ?

Ethan Brown
  • 26,892
  • 4
  • 80
  • 92
linux_prime
  • 9
  • 2
  • 8

1 Answers1

1

Try this

alert(typeof data[i].id);
ducdhm
  • 1,954
  • 15
  • 26