На странице загрузки показать значение в текстовом поле в JavaScript

0

Я использую asp.net mvc2.

Код Javascript:

$(document).ready(function () {
          $("#candidatecontact").hide();              
          document.getElementById("counting").value =  '<%=ViewData["ResumesCount"] %>';
            $('#butt2').click(function () 
            {
                 count();
            });
        });    

function count() {               
             var tempId = <%=Model.Id%>; 
             var url = '/Page/Count';
             $.ajax({
                    type: "GET",
                    url: url,
                    data: { id : tempId}, 
                    dataType: "int",
                    success : function (count) {                            
                        SetCount(count);                            
                    }
                });                                     
        }

Код HTML:

<% ViewData["ResumesCount"] = remainingHorsCount; %>
<input id = "counting" type = "text" style="width:20px;"/>

когда загрузка страницы в приведенном выше текстовом поле показывает значение ViewData["ResumesCount"].. Пожалуйста, дайте мне идеи для этого?

  • 0
    Это ASP или ASP.NET? Пожалуйста, добавьте тег, чтобы показать, что отвечает за <%...%> здесь.
  • 0
    я использую asp.net mvc .. я хочу только jquery
Показать ещё 2 комментария
Теги:
asp.net-mvc
input

1 ответ

0

Пытаться

<input id = "counting" type = "text" value="<%= remainingHorsCount%>" style="width:20px;"/>

или

<input id = "counting" type = "text" value="<%= ViewData['ResumesCount']%>" style="width:20px;"/>

Ещё вопросы

Сообщество Overcoder
Наверх
Меню