javascript window.location gives me a wrong url path when checking firebug
- by Elson Solano
I have a sample url website: http://mysite.com/
var host = window.location.protocol+"://"+window.location.hostname;
$.ajax({
type:"POST",
data: params,
url : host+'/forms/get_data.php',
success:function(data){
...othercodeblahblah
}
});
Why is it that when I try to check my firebug it makes the URL weird.
This is the sample output of firebug:
http://mysite.com/mysite.com/forms/get_data.php
With this url it now gives me:
"NetworkError: 404 Not Found - http://mysite.com/mysite.com/forms/get_data.php"
Shouldn't it output like http://mysite.com/forms/get_data.php ?
Why is it giving me a wrong url path?
Your help would be greatly appreciated and rewarded!
Thank!