• I am using this Dynamic Dependant DropDown List: US States & Counties in a form on a page outside of wordpress and it works fine. The problem is I cannot get it to work in a wordpress page using a page template, ie. page-test.php

    I have followed tutorials to register and and use wp_enqueue_scripts() but that isn’t making a difference. I know I did it right because the link to the path is showing in the headers and I am using
    <?php require(‘wordpress/wp-load.php ?> to integrate my theme into the page outside of wordpress.

    Using this method is working but I would rather use a page inside of wordpress. Can anyone tell me what more I need to do to get this to work inside of wordpress?

    btw, I am using the database option they provide. Inside the wordpress test page it is using the info from the database just fine – just not using the script to load the counties.

    You can see it here:
    https://ididntsee.com/test/ <– inside of wordpress not working.
    https://ididntsee.com/share-your-story.php <– outside wordpress working.

Viewing 7 replies - 1 through 7 (of 7 total)
  • It looks like this is your problem:

    https://ididntsee.com/test/getCounties.php Failed to load resource: the server responded with a status of 404 (Not Found)

    Can you check to make sure that file exists in the right location? Are you even trying to execute that file or are you trying to execute it within your page template? You will likely have to update some paths if you are trying to not use /test/getCounties.php

    Thread Starter thebusysingleparent

    (@thebusysingleparent)

    Thank you so much. I have no idea what you mean by execute but you led me to where I needed to find the problem. I added <?php require ‘getCounties.php’; ?> to the page template.

    It works but I don’t know if there is a better way or not.

    Thread Starter thebusysingleparent

    (@thebusysingleparent)

    It turns out that it did not work.

    Thread Starter thebusysingleparent

    (@thebusysingleparent)

    Finally fixed it.

    I don’t know why it didn’t work the first time I tried wp_enqueue_script and wp_register_script in the functions.php but this time it did.

    Glad to hear it’s resolved. =)

    Thread Starter thebusysingleparent

    (@thebusysingleparent)

    Actually it isn’t. I don’t understand what is going on because I just checked it and it is no longer working. I didn’t change anything since yesterday.

    Thread Starter thebusysingleparent

    (@thebusysingleparent)

    I believe I solved it – just delete this whole thing because I feel foolish.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Javascript won't work in page?’ is closed to new replies.