On my server side, I have something that looks like this:
Response.Write("<script>$(document).ready(function(){ SetTitle('" + userInput + "'); });</script>");
As you can see, this code is vulnerable to XSS attacks with an input like this:
'); alert('XSS attack');//
Here is my question: if I escape the single-quote (') on server side, will it be enough to stop XSS attack in this specific case? Or do you see other possible attack? Or may be I'm just setting my title the wrong way?