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

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

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

1 Comment

I will check your link. But for your awareness the above code generates purely jquery unobtusive codes. so it is completely jquery based : <form action="/Shahab/resources/search?puremode=1&amp;istab=1" data-ajax="true" data-ajax-begin="$(&#39;#searchResult&#39;).html(&quot;&lt;div class=&#39;bigprogress-icon t-content&#39;>&lt;/div>&quot;);" data-ajax-success="$(&#39;#searchResult&#39;).html(arguments[0]);" id="form0" method="post">

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.