How to break a jquery variable dynamically based on condition

Posted by Adi on Stack Overflow See other posts from Stack Overflow or by Adi
Published on 2013-11-08T03:49:49Z Indexed on 2013/11/08 3:53 UTC
Read the original article Hit count: 114

Filed under:
|
|

I have a jquery variable which has is showing the value in the console as ..

["INCOMING", 0, "INETCALL", 0, "ISD", 31.8, "LOCAL", 197.92, "STD", 73.2]

Now as per my need i have to break these values and make it like this

["INCOMING", 0],["INETCALL", 0],["ISD", 31.8],["LOCAL", 197.92],["STD", 73.2]

but these values i need to make in the required formate dynamically as this is received from database.

Here is my ajax call to get the values from server side..

var dbdata="";

        $(document).ready(function() {

            $.ajax({
                type: 'GET',
                url: 'getPieChartdata',
                async:false,
                dataType: "text",
                success: function(data) {

                   dbdata=JSON.parse(data);

                }

            });
            console.log(dbdata);

        });

Please guys help me . Thanks in advance..

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery