[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 464
  • Last Modified:

jquery get url

Hi i am trying to get a jquery gallery to work in my favorite CMS.

it uses jQuery.get to load php scripts in. my problem is that it is adding the relative page URL to the request when loaing the php scripts:

jQuery.get('getImages.php?count=none',function(i){

Open in new window


in console it shows the attempted url as:
http://localhost/sites/castle/index.php/test/getImages.php?count=none

but getImages.php is located in:
http://localhost/sites/castle/packages/mason_gal/blocks/mason_gal/getImages.php?count=none

how can i make it take the site url and not the relative url?

i have tried using ../../ but this breaks

thanks!
0
helpchrisplz
Asked:
helpchrisplz
1 Solution
 
GaryCommented:
Js will load resources from the directory the page is loaded from unless you add a / to the beginning of the resource name which will make it load from the root.
So it looks like you need to hardcode the url

jQuery.get('/sites/castle/packages/mason_gal/blocks/mason_gal/getImages.php?count=none',function(i){
0
 
helpchrisplzAuthor Commented:
thx
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now