you’re not trying to get the string “location.hostname”, right? You want the actual hostname from the URL? in that case you have to write the script include as a document.write.
document.write("<script language="javascript" src="http://test.com/test.php?q=" + location.hostname + ""><\/script>");
Something like that… WHY are you doing this?
1
solved Call php query with javascript [closed]