kala-tamin JQuery function fails when content loaded from Ajax form
صفحه اصلي

JQuery function fails when content loaded from Ajax form

I have a problem with an image that I am applying a custom jquery function against. Consider the following block of code.

<% Dim sUniqueIdent As String = Now.Ticks.ToString%>  <div id="chart<%: sUniqueIdent %>"></div>  <script type="text/javascript">    $(document).ready(function () {       bindLinksForChart<%: sUniqueIdent %>();    });     function bindLinksForChart<%:sUniqueIdent %>(){       $('div#chart<%: sUniqueIdent %>').chartLinks({           charturl: '<%: Model.ChartPath %>',            uniqueident: '<%: sUniqueIdent %>',            height: '<%: Model.Height%>',           width: '<%: Model.Width%>'               });    } </script> 

I have this embedded (deep) into some jQuery tabs, I use a unique identifier as there are a number of these charts.

the chartlinks function loads the image inside the div with a div of links floating over top that become visible when the user mouses over.

This works fine until I reload something on one of the tabs using an Ajax form. when the form loads, it loads all the content correctly however it fails to load the image and floating links (provided by the chartlinks function)

Here is the form

<% Using Ajax.BeginForm("Tab", New With {     .controller = "Content"}, New AjaxOptions With {     .UpdateTargetId = "chartDiv",      .InsertionMode = InsertionMode.Replace,      .OnSuccess = "bindLinksForChart<%:sUniqueIdent%>"})  <input type="submit" id="UpdateChart" value="Update Chart" /></p>  <%End Using%> 

Any assistance would be greatly appreciated

ps. chartDiv is the div that contains the partial view

asp.net mvc navigation on master page best practices


asp.net mvc postback
Could you elaborate a bit on where you declare the unique identifier and what you mean by reload any thing on one of the tabs?. How to make pages automatically use https when using asp.net mvc 2.0 I haven't tried this out although still commit this a shot.. is it possible to bind JQGrid OnSelectRow using Live?
<% Dim sUniqueIdent As String = System.Guid.NewGuid()%>  <div id="<%: sUniqueIdent %>" class="chart"></div>  <script type="text/javascript">    $(document).ready(function () {       bindLinksForChart("<%: sUniqueIdent %>");    });     function bindLinksForChart(indentifier){       $('.chart').chartLinks({           charturl: '<%: Model.ChartPath %>',            uniqueident: identifier,            height: '<%: Model.Height%>',           width: '<%: Model.Width%>'               });    } </script> 
This will allow you to have one java script function instead of a different function for every div this you have. Add new row(s) dynamically in emtpy table using telerik grid in ASP.NET MVCThen you must change your Ajax form code to:. ASP.NET MVC Routing Strange or Unexpected Behavior
<% Using Ajax.BeginForm("Tab", New With {     .controller = "Content"}, New AjaxOptions With {     .UpdateTarreceive Id = "chartDiv",      .InsertionMode = InsertionMode.Replace,      .OnSuccess = "bindLinksForChart(" + sUniqueIdent + ")"})  <input type="submit" id="UpdateChart" value="Update Chart" /></p>  <%End Using%> 
Which to learn: ASP.NET MVC or ASP.NET [duplicate]

59 out of 100 based on 64 user ratings 419 reviews