Hello,
I'm learning JQuery, and I'd like to isolate basic functionalities. On my 'Index" page, there is only one item, an 'AJAX.Link' displaying the following message 'Say Hello!". here's the mark up:
<div id = "helloDiv">
<% = Ajax.ActionLink("Say Hello!",
"Hello",
new AjaxOptions {UpdateTargetId = "helloDiv",
OnSuccess = "AnimatedHello"
})
%>
</div>
When clicked, the link calls the Hello action method located in the Home Controller.
public ActionResult Hello()
{
return Content("Hello World!");
}
On success, the Ajax.ActionLink calls the following JQuery function:
<script type = "text/javascript">
function AnimatedHello() {
$("#helloDiv").animate({ fontSize: "1.5em" }, 400);
}
</script>
Unfortunately, Instead of getting the updated in the same page (= the Index page), I rather get the "Hello World" message on a new page with the following URL (http://localhost:51531/Home/Hello). Of cause, there's no such page as Hello.aspx.
Why It's showing the 'Hello World' message in new blank page? instead of updating the on the Index page? Am I missing something?
I'm really new to JQuery. This sample comes from the ScottGu's NerdDinner Tutorial that I tried to adapt in order to understand how JQuery works.
Here's how I referenced the libraries:
<head runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.3.2.min-vsdoc.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
</head>
Thanks for helping