javascript - Sending data to the server from one field -
there form in field
<input type = "text" class = "form-control" id = "fio">
i need send separate name, surname, lastname. json: name: 'username', surname: 'usersurname', lastname: 'userlastname' can tell me how it? separate fields first name, surname clear, can name:
$ ('# name'). val (), surname: $ ('# surname'). val (), lastname: $ ('# lastname'). val (),
but 1 field send data?
<input type="text" id="fio" /> <input type="text" id="lastname" /> function senddata() { $.ajax({ type: 'post', url: '@url.action("names")', data: { surname : $("#fio").val() }, success: function (data) { // } }); } public actionresult names(string surname) { // }
Comments
Post a Comment