I have a problem which I am sure has a simple solution, but I haven't encountered before.
I have a HTML file, which calls a JavaScript API and retrieves values - this particular case calls a mapping API and retrieves co-ordinates when passed a postcode. However, for arguments sake, I will simplify to the following:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#myDiv").text("xValue,yValue");
});
</script>
<div id="myDiv">
</div>
However, as a .net HTTP GET request, this returns the page source, which has the empty div without the values injected:
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://mywebsite.com/myfile.html");
httpWebRequest.ContentType = "text/html";
httpWebRequest.Method = "GET";
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
There must be a better solution to this problem - I am only able to retrieve the values through JavaScript.