javascript - Jquery one click starts and second sends data -
i trying selected item dropdownlist , send data jquery function call function. works in debug put break on url, reclick button invoked , press continue. not work on over click. has experienced and/or know how solve it?
view:
<div> @using (html.beginform()) { @html.partial("~/views/notifications/notificationsdetails_actions_partial.cshtml", /*id*/model) @html.dropdownlist( "notification", new selectlist(viewbag.notification, "text", "value", new { name = "name" })) <button class="btn btn-default" id="updategames" type="submit" style="background-color: green; color: black;"> update games </button> <span class="glyphicon glyphicon-ok" id="updategamesok" style="display: none"> </span> <span class="glyphicon glyphicon-remove" id="updategamesfail" style="display: none"> </span> <span class="glyphicon glyphicon-refresh" id="updategamesworking" style="display: none"> </span> } </div>
jquery:
script> $(document).ready(function () { $('#updategames').click(function () { $.ajax({ type: "get", data: { name: $("#notification > option:selected").attr("value") }, url: '@url.action("updategames", "notifications")', datatype: "json", traditional: true, cache: false, context: document.body, beforesend: function () { $("#updategamesworking").css("display", "inline"); }, success: function (result) { $("#updategamesworking").css("display", "none"); if (result.message == "failed") $("#updategamesfail").css("display", "inline"); else $("#updategamesok").css("display", "inline"); } }); }); });
thanks in advance.
Comments
Post a Comment