Solved

jquery get url

Posted on 2013-05-13
2
448 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
ID: 39162679
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
ID: 39163130
thx
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
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)

813 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

17 Experts available now in Live!

Get 1:1 Help Now