WordPress.org

Ready to get started?Download WordPress

Forums

JSON from DB to template (1 post)

  1. intheblue25
    Member
    Posted 3 years ago #

    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);
    
                           }
    
                    });
     });

Topic Closed

This topic has been closed to new replies.

About this Topic