Reputation: 9034
I have the following code in MVC 3.0 with unobtrusive JavaScript enabled.
using (Ajax.BeginForm("search", new { puremode = 1 }, new AjaxOptions(){ UpdateTargetId="searchResult"} ))
{
<fieldset>
<legend>aaa</legend>
@Html.Partial("_SearchCriteria", Model)
<p>
<button class="t-button" type="submit">
<span class="icon16 xmag-png"></span>Search...</button><br />
</p>
</fieldset>
}
clicking on search button makes 4 Ajax requests simultaneously which causes to call "success" method 4 times too!
NOTE!!! If I disable the unobtrusive JavaScript the problem disappears! please check the attached image.
Upvotes: 1
Views: 317
Reputation: 9034
It seems the source of problem comes from Telerik bundling strategy. I described the problem here : Telerik forum hope to be helfull for others
Upvotes: 1
Reputation: 4244
Im not sure exactly what is happening. I never use the built in Ajax tools to do Ajax integration. Just use $.ajax. Its so simple and much easier to debug. It will also offer you finer control. If you dont want to hardcode your routes into your scripts, I suggest looking at this post http://haacked.com/archive/2011/08/18/calling-asp-net-mvc-action-methods-from-javascript.aspx. If you want some examples just let me know.
Thanks
Tyrone
Upvotes: 0