Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get a value from a serialized string

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

var data = $$.serialize();

Now there is an input field named 'title' and I want to get its value to show a message. So I am looking for a method to do just that. I've tried;

alert(data.name);

But found out it's not the method.

UPDATE

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

like image 544
Prasad N Avatar asked Jan 14 '23 07:01

Prasad N


1 Answers

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

$('#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
});
like image 102
Niccolò Campolungo Avatar answered Jan 16 '23 17:01

Niccolò Campolungo