Created
August 19, 2017 10:00
-
-
Save demofan/a12e2b2ba7442cbc774f33bd7d8a5619 to your computer and use it in GitHub Desktop.
Unobtrusive sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Html.Hidden("ajaxUrl",Url.Action("")) | |
<button type="button" data-ajax-url="@Url.Action("")"></button> | |
<script> | |
$(function () { | |
$(":input[data-ajax-url]").click(function (e) { | |
e.preventDefault(); | |
var current = $(this); | |
$.ajax({ | |
type: "POST", | |
url: current.data("url"), | |
data: "name=John&location=Boston", | |
dataType: "json", | |
success: function (response) { | |
} | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment