Forum Moderators: open

Message Too Old, No Replies

Ajax pathing with mod rewrite

problems loading a file into a div

         

dcampbell

5:25 pm on Aug 17, 2007 (gmt 0)

10+ Year Member



Hi folks

I have a javascript function which loads a page into a div:

function loadContent() {
$("#liveScores").load("mypage.php");
}

This works fine if I'm in the root of my website:

domain.com/page.php

however I have several rewritten urls (mod rewrite) on the site with paths such as:

domain.com/folder1/page.php
domain.com/folder2/page.php
domain.com/folder3/page.php

when trying to utilise the loadContent function on the rewritten pages I receive an 'Object Expected' error, i.e. mypage.php is not being loaded into the div.

I've tried adjusting the path, i.e.

$("#liveScores").load("../mypage.php");
$("#liveScores").load("/mypage.php");

etc, but consistently receive the same error message. Does anyone know how I can resolve this?

Thanks

dcampbell

5:27 pm on Aug 17, 2007 (gmt 0)

10+ Year Member



I should add that the template for the following files

domain.com/folder1/page.php
domain.com/folder2/page.php
domain.com/folder3/page.php

lives in the domain root folder, i.e.

domain.com/subfolder-template.php

thanks