/
Index.cshtml
43 lines (39 loc) · 1.45 KB
/
Index.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@{
ViewData["Title"] = "Ye Ke Model Binder";
}
<h1>@ViewData["Title"]</h1>
<button type="submit" onclick="postDataOld()" class="btn btn-primary">Post Arabic Ye Ke - model binder</button>
<button type="submit" onclick="postData()" class="btn btn-primary">Post Arabic Ye Ke - FilterAttribute</button>
@section Scripts
{
<script type="text/javascript">
function postData() {
$.ajax({
type: 'POST',
url: '@Url.Action("TestApplyCorrectYeKeFilterAttribute", "YeKeModelBinder")',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify({
Data: "ي ك ميشود"
}),
success: function (response) {
alert(JSON.stringify(response, null, ' '));
}
});
}
function postDataOld() {
$.ajax({
type: 'POST',
url: '@Url.Action("Index", "YeKeModelBinder")',
dataType: 'json',
contentType: 'application/x-www-form-urlencoded; charset=utf-8', //'application/json; charset=utf-8', doesn't work here
data: {
Data: "ي ك ميشود"
},
success: function (response) {
alert(JSON.stringify(response, null, ' '));
}
});
}
</script>
}