I am confuse how to achieve this
I have a external javascript file let say script.js and one <div>
tag in HTML file.
for example
<script src='script.js Full Path'></script>
<div id="div1">
</div>
Now, in my script.js file, i have ajax get function which calls Controller Action like below
$(function () {
var url = 'http://www.example.com/controller/GetHTML';
$.get(url, function (data) {
$('#div1').html(data);
});
});
and Controller Action is
public ActionResult GetHTML()
{
return View();
}
and view for GetHTML Action is
@{
ViewBag.Title = "GetHTML";
Layout = null;
}
<h2>This is HTML View</h2>
Now, i want render View as HTML
in to div1
, Even if i am not sure it's possible or not
So, Please any guys can help me to achieve above, it will really help me a lot.