Marcel
Marcel

Reputation: 906

php page tabs not loading using AJAX

i am using the tabs class I got from codecanyon... Basically I have a couple of tabs I want to show, but all the information are php files(not very large or resource consuming)...

I use the code below to load the pages. and on initial load the first page does load.(it has to access a DB etc when loading) and then i can browse to the second page(which at this point is only html). But as soon as I want to go back to the php page, it just keeps loading and loading...

I cannot use the get or post method in the library as I am already using the get method to pass a variable and the post discards away the get method value...

is there any way to see why the page does not load when the php code comes in?

I did notice this showing when I check the console in chrome(it apears once the page loads:

http://website/includes/tabs/inc/getcontent.php?filename=%2Fuser_management%2Fuser_profile.php&password=apphptabs 

Failed to load resource: the server responded with a status of 500 (Internal Server Error)`

But I am not 100% sure of what would cause it. because it initially loads perfectly...

## *** include tabs class
   define ("TABS_DIR", "includes/tabs/");
    require_once(TABS_DIR."tabs.class.php");

    ## *** create tabs object
    $tabs = new Tabs();

    ## *** set form submission type: "get", "post" or "ajax"
    $tabs->SetSubmissionType("ajax");

    ## *** set CSS style
    $tabs->SetStyle("grey");

    ## *** set Tabs caption
    //$tabs->SetCaption("ApPHP Tabs v".$tabs->Version());
    ## *** show debug info - false|true
    $tabs->Debug(false);

    ## *** set mode of displaying child tabs
    $tabs->SetChildTabsType("dropdown");

    ## *** allow refreshing selected tabs
    $tabs->AllowRefreshSelectedTabs(false);

    ## *** add tabs
    ## Example 1: $tabs->AddTab("Title");
    ## Example 2: $tabs->AddTab("Title", "text.txt");
    ## Example 3: $tabs->AddTab("Title", "text.txt", "icon.gif");#1");
    $user_profile=$tabs->AddTab("Personal Information", "user_management/user_profile.php");
    $permissions=$tabs->AddTab("Permissions", "user_management/permissions.php");

    ## *** set container's width
    $tabs->SetWidth("690px");
    $tabs->SetHeight("300px");
    //$tabs->SetWidth("100%");
    //$tabs->SetWidth("auto");

    ## *** choose a default tab
    $tabs->SetDefaultTab($user_profile);

    ## *** display tabs
    $tabs->Display();

Upvotes: 1

Views: 216

Answers (1)

Marcel
Marcel

Reputation: 906

I have found the solution

It apears when loading the php file in ajax the relative path I used does not work.

i just changed include('../../functions.php'); to require_once(__DIR__.'../../functions.php'); and the issue immediately resolved itself.

Upvotes: 1

Related Questions