I have the following code in a Razor view:
<div id="HTMLreturned" class="row">
@Html.Raw(ViewBag.HTMLreturned);
</div>
<script>
var nrLinks = 0;
$(".enlacesMas > a").each(function(){
nrLinks++;
var link = "http://www.meu.site" + $(this).attr('href').replace("..","");
// Agora preciso de guardar todos os link num array ou algo do género
});
</script>
No controller
put in ViewBag.HTMLreturned the result of this line:
ViewBag.HTMLreturned = WebClient.client.DownloadString(meuUrl)
How can I run the code of my view
in my controller
so I can save each href in a C # variable ?
Note:
The html
with which jQuery works is rendered before the script is executed, so these classes are html
within viewbag