WordPress.org

Support

Support » How-To and Troubleshooting » JSON from DB to template

JSON from DB to template

  • I am having trouble bring JSON into my page, I am able to put my results in an array and then use the json_encode() function, but when I try to retrieve those results I am getting null when trying to alert them to the screen just to see if I am getting anything. any help would be great. Also I am new to wordpress and its nuances, I have pasted my code below for suggestions.

    jQuery(document).ready(function(){
    
                   jQuery.ajax({
                       type: "GET",
                       url:"http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxx.php",
                       dataType:"json",
                       success:function(data){
    
           var myObject = JSON.parse(data, reviver);
    
            alert(myObject);
    
                           }
    
                    });
     });

  • The topic ‘JSON from DB to template’ is closed to new replies.
Skip to toolbar