Skip to content Skip to sidebar Skip to footer

Accessing Python Dictionary In Javascript

I am sending dictionary from python like this: {'root':['value','path','type'],.......} i am send it to javascript by ajax call request by serializing it, How to access that dicti

Solution 1:

Suppose you are making AJAX call in below way, you will get the response dict as resValue. use JSON.parse method on it

$.getJSON( "/url", {params }, function( data, status, xhr ) {
    $.each(data.response, function(resKey, resValue){
        if(resKey == "success"){
             var _result = JSON.parse(resValue);
        }
    }
}

Post a Comment for "Accessing Python Dictionary In Javascript"