powered by simpleCommunicator - 2.0.59     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Ajax всегда редирект на json result
1 сообщений из 1, страница 1 из 1
Ajax всегда редирект на json result
    #38969613
Pavluha
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Код: c#
1.
2.
3.
4.
5.
6.
7.
8.
9.
[HttpPost]
        public JsonResult FindPeople(String place)
        {
            return new JsonResult()
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new { result = "success" }
            };
        }



Код: javascript
1.
2.
3.
4.
5.
6.
7.
    <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

var getresult = function (data) {
        alert(data.result);
    };



Код: html
1.
2.
3.
4.
5.
6.
7.
 @using (Ajax.BeginForm("FindPeople", new { }, new AjaxOptions { OnSuccess = "getresult", HttpMethod = "post" }))
                        {
                            @Html.Hidden("place", Model.Warrant.workPlaceID) 
                            <button id="findBtn" type="submit">
                               <img src='@Url.Content("~/Content/images/save.png")' alt='' style="border:0;"/>@Html.Resource("Strings, Save")
                            </button>
                        }



Почему редиректится всегда на json result
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / ASP.NET [игнор отключен] [закрыт для гостей] / Ajax всегда редирект на json result
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]