I have a problem when sending asynchronous request to server, the url of server append to the current url and so the url will be incorrect!
I have anchors that send synchronous get request to controller using this way
<a href="<?php echo $this->url(array('module'=>'visits','controller'=>'visit','action'=>'index', 'page'=>'add'),NULL,TRUE); ?>" class="addVisit">Add new visit</a>
when I click over it the url becomes
http://inspectionsys/visits/visit/index/page/add
When I click on another button that send asynchronous request to server using ajax
jQuery.ajax({
url: "visit/get-visits",
type: "POST",
dataType: 'json',
data: requestDate,
success: successCallback,
error:failureCallback
});
the URL becomes like this
http://inspectionsys/visits/visit/index/page/visit/get-visits
The url must be like this
http://inspectionsys/visits/visit/get-visits
Any suggestions??