Syntax. Print var HTML in AJAX, doubt

0

I'm a little lost in AJAX and I'm learning. I have a couple of specific doubts and this is one of them.

If I write this:

$("#div_Result").html("<p>"+getname+getsurname+"</p>"   );

the result gives me this:

"Name""Surname"

How to formulate the syntax so that I avoid those quotes? Thank you very much

    
asked by rafa_pe 08.11.2016 в 11:33
source

1 answer

2

Solved:

I was storing the variables in local storage with JSON.stringify and inherited the feature.

Incorrect Way (in this case, it may be necessary in another circumstance to stringify)

    localStorage.setItem('respuestaServer.name', JSON.stringify(respuestaServer.name));   

Correct way

    localStorage.setItem('respuestaServer.name', respuestaServer.name); 

Thank you very much to all of you who have responded.

    
answered by 08.11.2016 в 11:51