Re: [fw-general] How to: relative paths inside javascript files

2008-11-11 Thread Jason Webster
I'd simply assign your baseUrl to a javascript variable. You could add 
this to the 'head' tag in your layout:


script type=text/javascriptvar baseUrl = ?php echo 
$this-baseUrl() ?/script


bytte wrote:

To keep my ZF project as portable as possible I make use of the baseUrl to
construct paths. However, today I'm facing a problem as I need to make a
reference to the baseUrl in my javascript file for an Ajax call. I'd rather
not work with an absolute path. What's your suggestions on this matter? 


Here's my jQuery function. As you see it has an absolute path in it. I'm not
sure how to construct relative paths inside my javascript file so it can
find the correct zend framework action.

$.ajax({
type: GET,
url: http://localhost/project-test/httpdocs/ti/deletepic/pic/;
+$pic+/format/json,
dataType: json,
beforeSend: function(){showLoading();},
success: function(json){hideLoading(json),emptyPicField();}
});

  




Re: [fw-general] How to: relative paths inside javascript files

2008-11-11 Thread bytte

Of course, thank you!



Jason Webster wrote:
 
 I'd simply assign your baseUrl to a javascript variable. You could add 
 this to the 'head' tag in your layout:
 
 script type=text/javascriptvar baseUrl = ?php echo 
 $this-baseUrl() ?/script
 

-- 
View this message in context: 
http://www.nabble.com/How-to%3A-relative-paths-inside-javascript-files-tp20443450p20445298.html
Sent from the Zend Framework mailing list archive at Nabble.com.