Get value from serialized string

There is a form, and on submit I convert it to a serialized string to submit the form via ajax.

var data = $$.serialize(); 

Now there is an input field called "title", and I want its value to display a message. So I'm looking for a way to do just that. I tried;

 alert(data.name); 

But I found out that this is not a method.

UPDATE

Here is the fiddle: http://jsfiddle.net/wHBYK/

+4
source share
1 answer

You don't need jQuery at all. Just do the following:

 $('#frmEditTab').submit(function(e){ e.preventDefault(); var title = this.title; //get the input named "title" of the form alert(title.value); //alerts the value of that input }); 
+6
source

Source: https://habr.com/ru/post/1482994/


All Articles