Asp.Net HtmlBeginForm() Jquery submit does not work -


i want display partial view using ajax, after form submitted. need listen submit event, , fire ajax display partial view. note: not need submit form using jquery or ajax, need catch event , fire ajax.

however, jquery function $("form").submit() not work!

i've put breakpoint in chrome debugger , not fired. problem? here code:

p.s. form consists of comboboxes user can select application name , version, charts of performance testing results displayed partial view using ajax.

@model performancedashboard.models.applicationdashboardviewmodel    <h3>per application</h3>      <br />    @using (html.beginform("index", "home", formmethod.post, new { id = "form" }))  {      // @html.antiforgerytoken()                                    <div class="selector-label">              @html.labelfor(model => model.applicationnames)      </div>        <div class="selector-combobox">          @html.dropdownlistfor(x => x.selectedapplication, model.applicationnames)          @html.validationmessagefor(x => x.selectedapplication)          </div>        <br />            <div class="selector-label">          @html.labelfor(model => model.testingtypes)      </div>        <div class="selector-combobox">          @html.dropdownlistfor(x => x.selectedtestingtype, model.testingtypes)          @html.validationmessagefor(x => x.selectedtestingtype)      </div>        <br />            <div class="selector-label">          @html.label("range")      </div>        <div class="selector-combobox">          @html.dropdownlistfor(x => x.selectedfirstversion, model.firstversion)          @html.validationmessagefor(x => x.selectedfirstversion)          &nbsp;          @html.dropdownlistfor(x => x.selectedsecondversion, model.secondversion)          @html.validationmessagefor(x => x.selectedsecondversion)      </div>            <br />            <input type="submit" value="generate" />        }    <div id="displayarea">    </div>      <script>        $(function () {            $("#form").submit(function (e) {                e.preventdefault();              alert("form submitted!");                $.ajax({                  type: this.method, //'post'                  url: this.action, //'/controller/index'                  datatype: 'html',                  success: function (result) {                      $('#displayarea').html(result);                  }              });          })      });    </script>

omg!! problem did not reference jquery in html! line solved problem:

<script src="~/scripts/jquery-1.10.2.js"></script>

thanks!


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -