How to call a json post function after update panel postback?
I have a gridview inside of UpdatePanel. I need to call json function after update panel refreshed.
Here is the example of my code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GrvHabits" runat="server" BorderWidth="1" ShowHeader="False" AutoGenerateColumns="false"
CssClass="mGrid" PagerStyle-CssClass="pgr" Width="90%" AlternatingRowStyle-CssClass="alt"
OnRowDataBound="GrvHabits_DataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
and here is my json function
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', { packages: ['corechart'] });
function drawVisualization() {
var id = $('#Id').text();
$.ajax({
type: "POST",
开发者_如何学Curl: "/Services/Charts.asmx/Draw",
data: "{Id: " + id + " }",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
var items = response.d;
Handle the endrequest event of the page: http://msdn.microsoft.com/en-us/library/bb383810.aspx
So the solution for my problem very simple.
I have changed function name to function pageLoad() {}.
And it works like a charm :)
精彩评论