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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -