// php:
$result = file_get_contents('http://localhost:3000/test');
// nodejs:
app.get('/test', function (req, res) {
res.send('Hello World, this a test!')
})
<script>
var data = [{ id: 0, text: 'enhancement' }, { id: 1, text: 'bug' }, { id: 2, text: 'duplicate' }, { id: 3, text: 'invalid' }, { id: 4, text: 'wontfix' }];
$(".yourClassSelector").select2({
data: data
});
</script>
<input type="hidden" name="test" class="yourClassSelector">