Issue:
You use the online compression utility jscompress.com to compress your js file but it fails with an error. Why this may be happening and how to fix it.
Possible causes:
Apparently not using open and closing curly brackets in an IF statement would cause this. Well turns out this is not the case. Look at the following example and see if you can figure out what the issue is :-)
function SetupDeliveredVPRecontactNotes($item, id) {
var theData;
$.ajax({
data: { deliveredVPId: id },
url: $('#ajaxGetDeliveredVPRecontactNotesUrl').val(),
type: "GET",
async: false,
dataType: "html",
success: function(data, result) {
$item.empty();
var input = '<textarea class="recontactNote" rows="4" name="DeliveredVPRecontactNotes_' + id + '" id="DeliveredVPRecontactNotes_' + id + '" cols="115">' + data + '</textarea>';
$item.append(input);
theData = data;
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$item.empty();
alert("An error occurred: The operation to retrieve the DeliveredVP's Recontact Notes has failed");
}
}); //ajax
return theData;
}
Solution:
The '</textarea>' concatenates text is causing the issue. Replacing it with '</' + 'textarea' fixes the issue.