title: How do I add returned JavaScript array items to specific textboxes
body: <p>I called a URL using AJAX using the following code below and it returned 2 items in an array in this format ["item1", "item2"]</p>
  
  <pre><code>function getbook()
  {        
      $.ajax({
          type: "POST",
          url: "/Home/getBooked",
          data: { "bookNumber": mobile },
          success: function(succ) { // I need to add the items in succ to some text boxes as shown below
              $.each(succ, function (index, element) {
                      $('#tb1').val(element);
                      $('#tb2').val(element);
              });                           
          },
          error: function(err) { 
              alert("An error is thrown"); 
          }
      });
  }
  </code></pre>
  
  <p>But the issue is that only the last item in the <code>succ</code> array is shown in both the textboxes. When I used the alert function to display the contents of <code>succ</code>, it displayed both the items. Clearly i'm missing something. I'll be glad if anyone could help.</p>