get a value from a serialized string

11,843

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
});
Share:
11,843
Prasad N
Author by

Prasad N

Updated on June 15, 2022

Comments

  • Prasad N
    Prasad N almost 2 years

    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/

  • Niccolò Campolungo
    Niccolò Campolungo almost 11 years
    If you want, you can also use only Vanilla JS, no jQuery. It's just changing few lines of code