Solved

jquery get url

Posted on 2013-05-13
2
452 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Date on a table 16 34
Can't get js code to execute 8 31
how to customize the text in the legend in highcharts 3 34
Glitching Slide Show 19 27
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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)

749 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