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();}
});