There is a function building table.
This function is called when the page loads.
var strResult = ""; $.each(contacts, function (index, contact) { strResult += "<div class=\"row\">"; strResult += "<input class=\"form-control\" value=\"" + contact.ID + "\"/><input id=\"first_name+" + contact.ContactID + "\" class=\"form-control\" value=\"" + contact.first_name + "\"/>; strResult += "<button name=\"del=" + contact.ContactID + "\" data-action=\"Delete\" class=\"btn btn-default btnDel\"><span class=\"glyphicon glyphicon-remove\"></span></button>"; strResult += "</div>" }); $("#divResult").html(strResult); And the button which click is processed here
$('body').on('click', '.btnsv', function () { var id = CutId(this.name); // обрезка id имя кнопки var contact = // здесь хочется, чтобы данные из input first_name + contactID записывались сюда $.ajax({ url: 'http://localhost:55285/api/values/', type: 'POST', data: JSON.stringify(contact), contentType: 'application/json; charset=utf-8', success: function (data) { }, error: function (x, y, z) { alert(x + '\n' + y + '\n' + z); } }); }); Tell me, please, how to do it
$('#first_name+' + id).val() // не работает
не работает.what exactly is expressed? Any errors betrays or begins to run in shorts around the house and scream - help rape? - Alexey ShimanskyCutIdnothing .... - Alexey Shimansky