I have a js function , which Fortify identified as XSS vulnerable as below. Can someone suggest any solution for this since the method is intensively used in my web system.
I am here trying to call a partialview in ajax and the result html am appending to a specified dom div
My function look like the below
success: function(json) {
if ((dataType == "json") && (json !== true)) {
var errorInForm=false;
for (var i = 0; i < json.length; i++) {
var value = json[i];
var errorFieldId = value[0];
var errorField = $($("#" + errorFieldId)[0]); //this is Fortify error