<meta name="viewport" content="width=device-width" />
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
$('#theButton').click(function () {
var stockValues = $(".stockvalue");
$.each(stockValues, function (index, aValue) {
theArray.push(aValue.value);
url: '@Url.RouteUrl(new{ action="MyAjaxCallMethodPassingArray", controller="Home"})',
data: { 'arrayOfValues': theArray },
success: function(data) {
$("#showAnswer").html(data);
<div id="showAnswer"></div>
<input type="text" class="stockvalue" />
<input type="text" class="stockvalue" />
<input type="text" class="stockvalue" />
<input type="text" class="stockvalue" />
<input type="button" value="Go" id="theButton" />