Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've run into another Ajax problem in ASP.NET MVC I have the following Ajax.ActionLink that successfully retrieves the desired data. The problem is, instead of placing the results into the
element like Ajax is intended for, it instead reloads the web page and gives the data result at the top of an otherwise blank web page.

I'm trying to figure out why it's not placing the results in the div tag. I'm not currently using a partial view, but I've seen it done with and without a partial view before.

What I have tried:






@Ajax.ActionLink("LOCUS", "Get", "api/CompRounds",
new { Param1 = 1, Param1 = "dat1" },
new AjaxOptions
{
HttpMethod = "GET",
UpdateTargetId = "divCompRounds",
InsertionMode = InsertionMode.Replace
}, new { style = "margin-right:10px", @class = "btn btn-success" })




Posted
Updated 19-Apr-18 21:58pm

1 solution

You probably aren't including the unobtrusive ajax js files

Ajax.ActionLink and Html.ActionLink in MVC
[^]

If you are including them make sure they're loading ok (check the network tab of the browser tools) and also check there aren't other js errors in the error console. It's most likely that you're just not including the unobtrusive js files though.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900