On click I'm getting text in HTML. I have a variable in Javascript called content I want to get the text input and change a part of the Javascript variable.
HTML CODE:
<html>
<head>
<link href="latent.css" rel="stylesheet">
</head>
<body>
<button onclick="makePage()">Generate Link</button>
Image link: <input type="text" name="img" id = "img"><br>
Content: <input type="text" name="content" id = "content"><br>
<script src="makePage.js">
</script>
<script>
var img = document.getElementById("img").value;
var content = document.getElementById("content").value;
</script>
</script>
</body>
</html>
JAVASCRIPT CODE:
function makePage(){
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200)
alert("webpage " + xmlhttp.responseText + " was successfully created!");
}
var content = '<html><head><meta name="something:something" content=""></head><body></body></html>';
xmlhttp.open("GET","http://ahansabharwal.com/makePage.php?content=" + content, true);
xmlhttp.send();
}
In the variable called content I want to replace the image link in the content of the twitter:image meta name="twitter:image" content="http://graphics8.nytimes.com/images/2012/02/19/us/19whitney-span/19whitney-span-articleLarge.jpg"
AND
I would like to replace the content of the meta name="twitter:description" content="NEWARK - The guest list and parad[....] with the content inputted by the user.