0

I have aspx page with form which fire result to div on the same page. I need to process hrefs inside result output. Which action should be used in this case? $(document).ready and $(document).ajaxComplete didn't work. Concerning ajaxComplete as I understand it is because not a jQuery routine is used by page controls.

<script type="text/javascript" language="javascript">
$(document).ajaxComplete(function() {
    $('a[href*="mouz"]').removeAttr('href');
    });
</script>
revoua
  • 2,044
  • 1
  • 21
  • 28
  • For load event, try this $(window).load(function(){ ... }); – aimadnet Apr 25 '14 at 22:30
  • If I undertand you well, you want when you click an `a` link you put the result in a `div` by an `Ajax` call? –  Apr 25 '14 at 22:30
  • when you say "aspx page with form which fire result to div", what do you mean? what exactly is triggering this? update panel? – attila Apr 25 '14 at 22:35
  • @attila yes, update panel. – revoua Apr 25 '14 at 22:38
  • 1
    this appears to be what you want: http://stackoverflow.com/questions/1190549/how-can-i-run-some-javascript-after-an-update-panel-refreshes – attila Apr 25 '14 at 22:41
  • Show us the code that is loading the dynamic content. We need to see that in order to know how to advise you how to wait for it. – jfriend00 Apr 26 '14 at 00:02
  • @attila `Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);` solved, thanks. If you post as answer I will accept :) – revoua Apr 26 '14 at 06:30
  • @revoua - glad it helped. I have added as answer for posterity. – attila Apr 26 '14 at 14:24

2 Answers2

0
<script type="text/javascript" language="javascript">
$(window).load(function() {
// executes when complete page is fully loaded, including all frames, objects and images
alert("window is loaded");
});
</script>
aex
  • 85
  • 1
  • 9
0

Here is the answer, adapted from MSDN - http://msdn.microsoft.com/en-us/library/bb397523(v=vs.100).aspx

In your client script add the following

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);

to handle the event,

function pageLoaded(sender, args) {
  //get all of the panels which have been updated
  var updatedPanels = args.get_panelsUpdated(); 

  //perform the removal of the href attr on the DOM element collection
  $(updatedPanels).find('a[href*="mouz"]').removeAttr('href');

}
attila
  • 2,219
  • 1
  • 11
  • 15