Reputation: 2860
I have an MVC view in which I construct a div with some dynamic data.
<div>
<p>Dynamic content</p>
</div>
Once the Div is finished rendering I want to hit a controller action method with a parameter of ( the inner source content of the div ).
This is running in a web job so there is no user interaction to click a button.
I tried to post the div inner HTML content, which works fine.
document.getElementById("divContent").innerHTML
but I want this to happen after div has finished rendering.
Upvotes: 2
Views: 231
Reputation: 133
$( "#DivId" ).load(function() {
$.ajax({
type: 'GET',
url: '/Controller/Method',
data: { ParamName: document.getElementById("DivId").innerHTML},
success: function(result) {
}
});
});
this event will fire when the div is loaded.
Upvotes: 1