How to access javascript value in jsp?

Hi i am using jquery. like,

 <script type="text/javascript">

$(function() {

         $('#usertype').change(function() {
                $.post("<%=request.getContextPath()%>/CommonServlet", {utype:$('#usertype').val(),funName:'getConfigMast'},  function(j){
                 $("input#it").html(j);alert(j);

             });
         });
 });

</script>

in this j contians some model object i have to iterate his object in my same jsp page and those values i have to show in text fields in <table>. here the jquery function will called when i selected the the value from combobox of same <table>

and jsp table:

<table >    
    <tr>
      <td><input name="filetype" type="text" class="formTxtBox_1" id="filetype"/></td>
    </tr>
    <tr>      
      <td>
          <select name="usertype"  id="usertype" >
            <option >- Select Type of User -</option>
            <option value="admin"> administrator </option>
            <option selected="true" > normal</option>
            <option> member</option>
          </select>      </td>
    </tr>
 <tr>  
   <td><input name="singlefile" type="text" id="singlefile"/></td>
    </tr>
 <tr>
   <td><input name="totalfile" type="text"  id="totalfile"/></td>
    </tr>
<table>

Answers


The value of an input field needs to be set using val() function, not html().

$('#singlefile').val(value);

Need Your Help

Display image using CSS in MVC 2

asp.net css asp.net-mvc asp.net-mvc-2

In MVC 2 I'm trying to display a image On my master page using CSS.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.