{"action":"opened","issue":{"url":"https://api.github.com/repos/select2/select2/issues/3525","labels_url":"https://api.github.com/repos/select2/select2/issues/3525/labels{/name}","comments_url":"https://api.github.com/repos/select2/select2/issues/3525/comments","events_url":"https://api.github.com/repos/select2/select2/issues/3525/events","html_url":"https://github.com/select2/select2/issues/3525","id":91047978,"number":3525,"title":"Select2 Markup gets corrupted on reload","user":{"login":"MarioVanDenEijnde","id":12608918,"avatar_url":"https://avatars.githubusercontent.com/u/12608918?v=3","gravatar_id":"","url":"https://api.github.com/users/MarioVanDenEijnde","html_url":"https://github.com/MarioVanDenEijnde","followers_url":"https://api.github.com/users/MarioVanDenEijnde/followers","following_url":"https://api.github.com/users/MarioVanDenEijnde/following{/other_user}","gists_url":"https://api.github.com/users/MarioVanDenEijnde/gists{/gist_id}","starred_url":"https://api.github.com/users/MarioVanDenEijnde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarioVanDenEijnde/subscriptions","organizations_url":"https://api.github.com/users/MarioVanDenEijnde/orgs","repos_url":"https://api.github.com/users/MarioVanDenEijnde/repos","events_url":"https://api.github.com/users/MarioVanDenEijnde/events{/privacy}","received_events_url":"https://api.github.com/users/MarioVanDenEijnde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-25T19:02:25Z","updated_at":"2015-06-25T19:02:25Z","closed_at":null,"body":"On the initial load the script below works fine. But when performing a reload (without page refresh) the Markup gets corrupted because for example the \"suggestion.image\" data result is not found by the formatSearchSelection function. Only \"id\" and \"text\" are available in the formatSearchSelection function.\r\n\r\nPlease advise.\r\nKind regards,\r\nMario\r\n\r\n```\r\nfunction populateSearchBox(data){\r\nvar datalocal = [{id:4,text:'Jansen',column01:'',contentType:'Companies',image:'/WPPi/Company-Orange.png'},{id:5,text:'Cornelissen & Zn',column01:'',contentType:'Companies',image:'/WPPi/Company-Orange.png'}];\r\n    $(\".searchBox\").select2({\r\n      data: datalocal,\r\n      placeholder: \"Search\",\r\n      escapeMarkup: function (markup) { return markup; }, // let our custom formatter work\r\n      //minimumInputLength: 1,\r\n      templateResult: formatSearchSuggestions,\r\n      templateSelection: formatSearchSelection\r\n    });\r\n}\r\n\r\n    function formatSearchSuggestions (suggestion) {\r\n        return \"<img src='\" + suggestion.image + \"' alt='img'>   <b>\" + suggestion.text + \"</b><br/>\" + suggestion.column01;\r\n    }\r\n    function formatSearchSelection (suggestion) {\r\n        if (!suggestion.id){\r\n        return \"Search\";\r\n        }else {\r\n        return \"<img src='\" + suggestion.image + \"' alt='img'>   <b>\" + suggestion.text + \"</b><br/>\" + suggestion.column01;\r\n        }\r\n    }\r\n```"}}