trying to get ajax request to work
- function loadPages() {
- var url = "/api/ChartAPI";
- $.ajax({
- url: url,
- type: "GET"
- }).done(function (resp) {
- //Get the number of pages.
- //Consider here the page size as 10
- var pgSize = resp.length / 10;
- //If the Result is float, then Round it to 1
- if (isPgSizeFloat(pgSize)) {
- pgSize = Math.round(pgSize);
- }
- //Add Pages in the DropDown for record Pages
- var pgHtml = "";
- for (var i = 1; i <= pgSize; i++) {
- pgHtml += "<option value=" + i + ">" + i + "</option>";
- }
- //Add Page Numbers
- $("#lstRecPages").append(pgHtml);
- }).on("error", function () {
- $("#dvMsg").html("Error " + err.status);
- });
- };
I'm using jquery-3.2.1.min.js
I'm getting an error because originally it used the .error function, but that doesn't exist anymore, so I'm trying to use the .On function.
Can someone tell if there's a way to fix this ajax request?