1

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.

Firebug result

Nicolas Henneaux
  • 11,507
  • 11
  • 57
  • 82
Mahmoud Moravej
  • 8,705
  • 6
  • 46
  • 65

2 Answers2

1

It seems the source of problem comes from Telerik bundling strategy. I described the problem here : Telerik forum hope to be helfull for others

Mahmoud Moravej
  • 8,705
  • 6
  • 46
  • 65
0

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

TYRONEMICHAEL
  • 4,174
  • 4
  • 30
  • 47
  • I will check your link. But for your awareness the above code generates purely jquery unobtusive codes. so it is completely jquery based :
    – Mahmoud Moravej Dec 15 '11 at 15:49