View Full Version : Ajax Tabs Content Script - Call php

05-31-2010, 03:00 AM
1) Script Title: Ajax Tabs Content Script (v 2.2)

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex17/ajaxtabscontent/index.htm

3) Describe problem:

I'm trying to call a php file instead of html. Is this possible? I'm not able to get it working...There must be a work-around...

05-31-2010, 03:22 AM
I don't understand why this would be a problem. You should be able to just change the URL from page.htm to page.php and it will work.

Note: If you are testing this script locally (on your computer), it may not work. There are different security restrictions while using the script locally. Upload it to your website and it may work. I believe this is especially problematic (in some cases) in Internet Explorer. But for all browsers it will be more realistic to test while upload anyway.

If you need more help:
Please post a link to the page on your site that contains the problematic script so we can check it out.

05-31-2010, 03:29 AM
I thought it should work also. However, I get a fatal error on line 1 for the php I'm trying to call. The only difference I can see is that it is currently all located within a pw protected directory. Not local, though...

Any ideas?

05-31-2010, 03:34 AM
As I said above, no one can help you without a link to your page.

From what you said though, this has nothing at all to do with the script. Any error is from the PHP, not from the Javascript.
(I'm talking about PHP errors displayed on the included page.)

In fact, if you see an error there then this means the script is working-- but there's a problem with the PHP.

Depending on what happens, you may wish to repost the question in the PHP section to get help there. If so, please do so outside of this script: it will make things simpler to fix. Just link directly to the PHP page. You should see the same error. If not, there may then be some issue with how you are calling the page (for example if you need to be logged in, etc), but you should probably still fix the PHP script to not show an error and instead display alternative content.
And read the fatal error message carefully: it should tell you how to fix it.

05-31-2010, 04:09 AM
I can't give a link to the page as it's not fully functional yet, but I am working within wordpress, so I think there is an issue there that I need to resolve. Any experience dealing with WP? I think I need to place the php code I want to use inside the WP loop, and then call that php file from this ajax code ... sound about right?

05-31-2010, 05:18 AM
I've never worked with wordpress, but here's how Ajax works:
Ajax loads the page behind the scenes into a variable in Javascript. If desired (as in this case) that can then be displayed to the user (or you can do something else with it).

So the important part there is that Ajax is not special in relation to PHP: whatever Ajax gets is the same thing you get when you load the page directly [in the same way].

The way to fix this is to ignore everything with Ajax and work out the PHP. Go to the URL for the PHP. Work from there. It may very well be a problem with wordpress. But it's not a problem due to Ajax.