I just need to run a method when the page is finished loading.
Here's the js i'm using:
<script type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "GET",
url: document.URL + "/LoadAssignees"
});
});
</script>
And here's the method that i'm attempting to run:
[WebMethod()]
protected void LoadAssignees()
{
//load assignees
var sw = Stopwatch.StartNew();
sw.Start();
cboAssignees.DataSource = Uti.GetAssigneeList(_currentUser, 1, false);
sw.Stop();
cboAssignees.DataTextField = "Name";
cboAssignees.DataValueField = "Guid";
cboAssignees.DataBind();
Response.Write(string.Format("Assignee load time: {0}", sw.ElapsedMilliseconds));
}
I felt like i was doing this right. I'm not getting any errors, but nothing is happening. I set a breakpoint on the method and it isn't getting hit, so I'm guessing my ajax call is incorrect. What am I missing?
On a side note, what I'm trying to do is run a method asynchronously as soon as the page is done rendering. If you can suggest a better way to accomplish that, that'll work for me as well :) thanks.