With jQuery AJAX how get name field writed in thank you message

With jQuery AJAX how get name field writed in thank you message
0

#1

Something like get the value

var name = $('#name').val();

But I not got that how can write this name include on succesfully sent message like with AJAX include success function:

success: function() {
$('#u_touch_general').html('thank you '+ name');
}

Something this but not work any idea?


#2

@bestdesign,
Your success function should receive a parameter with whatever it needs.

I.E.

success: function(data) { $('#u_touch_general').html('thank you '+ data.name); }


#3

Take a closer look at your syntax in here: $('#u_touch_general').html('thank you '+ name'); especially at the ' after name


#4

Still a question please!

I have $('#test').on('submit', function(e) {
inside it I have $.ajax but where I can put the var name = $('#name').val(); ?

On thank you message write undefinied.