Skip to content

"the results could not be loaded" error condition doesn't work with timeout #6372

Open

Description

@aliber4079

"the results could not be loaded" error condition is correctly generated for errors like 404, 500, but not for timeout condition

Minimal case:

Browse to http://localhost/select.html

Expected: After 1000 ms, "the results could not be loaded" is displayed right below dropdown

Actual: No error is displayed

sleep.php:

<?php
sleep (20);

select.html

<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<link href="select2.css" rel="stylesheet">
</head>
<body>
<select id="dropdown"></select>
<script src="jquery-3.7.1.js"></script>
<script src="select2.full.js"></script>
<script>
$(function(){
	$('#dropdown').select2({
		debug:true,
		ajax: {
			url: '/sleep.php',
			timeout: 1000,
			error: function(a,b,c) {
				console.log("oops");
			},
			data: function (params) {
				return {
					query: params.term
				}
			},
			
		},
		width: "50%"
	})
});
</script>
</body>
</html>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions