Fill in custom field of type contact reference field from javascript returns TypeError
The solution is to use 'data' instead of 'val':

CRM.$("#s2id_custom_13_-1").select2('data', { "id": 188, "text":"NAME OF THE CONTACT"} );