-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlimit-locations.js
23 lines (22 loc) · 948 Bytes
/
limit-locations.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(function ($) {
$(document).ready(function () {
var currentURL = window.location.href;
let expectedURL = 'https://thevanmancan.co.uk/submit-listing/';
if (currentURL === expectedURL) {
var planID = $("[name='plan_id']").val();
var inputCity = $("#inputCity");
$.get("https://thevanmancan.co.uk/wp-admin/admin-ajax.php?action=get_locations_limits&plan_id=" + planID, function (data, status) {
var resp = JSON.parse(data);
var limitNew = resp.limit ?? 1;
inputCity.select2({
maximumSelectionLength: limitNew,
language: {
maximumSelectionLength: function (limit) {
return 'You have reached the maximum for your subscription/plan.';
}
},
});
});
}
});
})(jQuery);