This is my first time calling AJAX from within jQuery so please bear with me here. I have a JSON file where I have formatted all of my data, and would like to simply call the JSON file and append some of the data to my HTML.

I should let everybody know that I am using WordPress as a backbone for the site, though the PHP-based framework is not being utilized at all to my knowledge in this call, I did try and write out my URL to make sense within the jQuery. All of the id’s in the slugArray array exist within my HTML.

OK! So:

JSON file can be seen here:


var slugArray = [
function getWWD(){
    for (i=0; i<=slugArray.length; i++) {
        var selection = slugArray[i];
            $.getJSON('../ajax-call-not-working-in-wp-based-site/wp-content/themes/bmgz/data/whatwedo.js', function(result){
                alert("It works!");
                var entry=result.whatwedo[0].id;

When I run this, I don’t get anything, not even my alert. I was getting a 404 error when I typed in the URL wrong for the $.getJSON request, so I know the computer is reading it at least partly. Thanks guys! I appreciate any input!

Read more here: AJAX call not working in WP based site


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: