I am sending an ajax request to my server like this :
var data = '';
$.ajax({
type: 'GET',
url: 'api/getnews/home/post/'+title,
data: data,
datatype: 'json',
success: function (data) {
var obj = JSON.parse(data)[0].fields;
console.log(obj);
}
});
The url becomes
http://127.0.0.1:8000/home/post/api/getnews/home/post/title , if I am at http://127.0.0.1:8000/home/post
But , I want it to be :
Any Suggestion..
You can try url
window.location.origin + '/api/getnews/home/post/' + title
Or
'/api/getnews/home/post/' + title
like kusiaga
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments