I am trying to scrape webpage content to my form controls, Without function i am getting output, but when i created function and assigned to button click event to display the output in textbox its not working, let me know where i am messed.
<script type="text/javascript">
function Assign()
{
$html = file_get_contents("http://geoportaal.maaamet.ee/url/xgis-ky.php?ky=79401:006:0812");
preg_match_all('(<li.*?>.*?</li>)', $html, $matches);
$one=$matches[0][0];
document.getElementById("OutputField").value = $one;
}
</script>
<input id="OutputField" type="text" style="width:200px"/>
<input type="button" value="Assign Value" onclick="Assign()"/>
See Question&Answers more detail:os