Reputation: 53
I want to change some partial-view html code after the partial-view is loaded by this function
$("#myRootElement").load("MyAction?Parameter=" + value);
I saw inside the JQuery source code, there is a
$("#myRootElement").innerHtml = "MyPartialViewHtmlCode"
But I didn't find any event fires after this inner html is set. I want to fires a event after this here is what I have tried.
$("#myRootElement").on('load', function(){
// My code.
})
$("#myRootElement").load('action?parameter=' + value);
It doesn't work at all. The break point never been hit.
Upvotes: 0
Views: 51
Reputation: 191
You can see this page, there is a callback param. Use like this
$("#myRootElement").load("MyAction?Parameter=" + value, function() {
alert( "Load was performed." );
});
Upvotes: 1
Reputation: 1074
load provides a callback you can use
$("#myRootElement").load('action?parameter=' + value, function() {
// load complete do stuff
});
Upvotes: 1