Solved

jquery get url

Posted on 2013-05-13
2
446 Views
Last Modified: 2013-05-13
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
Comment
Question by:helpchrisplz
2 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
Comment Utility
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
 
LVL 1

Author Closing Comment

by:helpchrisplz
Comment Utility
thx
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now