I have been writing some ajax call in an external javascript file, finding some difficulties to set the URL. When I check in the console that URL does not reach at controller. I wrote url in ajax as:
$.ajax({
type: 'POST',
url: 'project/projectDelete',
data: project_id,
success: function(msg){
if(msg == 'done') {
$('.loaderContainer').hide();
$('#'+projectid).parent().parent().remove();
}
}
}); //END $.ajax
I got in console the URL request as http://localhost/example/index.php/cp/project/project/projectDelete. But it should be http://localhost/decksgo_new/index.php/cp/project/projectDelete. Is there any correct way to define URL in ajax in Yii external javascript.