Недопустимые данные JSON$. get() метод-uncaught syntaxerror: unexpected token <
Мне нужна помощь, ребята.
Я пытаюсь получить данные с сервера, который возвращает данные JSON, но получаю следующее сообщение об ошибке (в Firefox 48).
Uncaught SyntaxError: неожиданный токен & lt;
Похоже, что возвращаемые данные JSON недействительны или находятся не в ожидаемом формате.
Когда я запускаю его в Chrome 52, нет никакого сообщения об ошибке, и данные возвращаются в ответ, но он не запускает код внутри моей функции.
Мой сервер возвращает данные в следующем формате JSON.
[{ "ActionCardId": 1, "ActionCardNumber": "279877", "AccountNo": "2202322179", "ClientName": null, "CellNumber": "0787596971", "TenantName": null, "TenantCellNumber": null, "AddressStandNo": null, "AddressStreet": "43 DELMAS AVENUE", "AddressSuburb": "BOKSBURG", "AddressCity": null, "AddressPortion": null, "AddressEarthNo": null, "AddressPremise": null, "AddressGISKEY": null, "AmountDueTotal": 4080.0, "AmountDue30Day": null, "AmountDueCurrent": null, "AmountDue60Day": null, "ServiceLevy": null, "MeterNumberWater": null, "MeterNumberElectricity": "M22541", "MeterNumberElectricity2": null, "MeterNumberElectricity3": null, "MeterNumberPrePaid": null, "IsPrinted": true, "IsResidential": null, "ActionSuccessful": false, "ActionCardDate": "2016-08-22T00:00:00", "Remarks": null, "UnSuccessfulReason": null, "CaptureContractorId": null, "AddressCombo": ", 43 DELMAS AVENUE, BOKSBURG, , ", "BillCycleName": "120", "ServiceIndicator": null, "WaterReading": null, "WaterReadingDate": null, "ElectricityReading": null, "ElectricityReadingDate": null, "Unit": null, "ActionCardTypeId": 2, "ContractorId": 1, "ActionCardStatusId": 1, "UnSuccessfulActionReasonId": null, "TechnicianId": 1, "AccountInfoId": null, "ServiceDeliveryCentreId": 4, "BillCycleId": 2, "ActionCardType": null, "Contractor": null, "ActionCardStatus": null, "UnSuccessfulActionReason": null, "Technician": null, "AccountInfo": null, "ServiceDeliveryCentre": null, "BillCycle": null, "ActionName": "ED", "DateCreated": "2016-07-06T00:00:00", "DateModified": "2016-08-13T10:24:17.5833635", "CreatedByOnlineUserId": null, "ModifiedByOnlineUserId": "fa93e65d-e4a7-4a0c-91c6-4561e2612f9c", "CreatedByUser": null, "ModifiedByUser": null }, { "ActionCardId": 2, "ActionCardNumber": "279876", "AccountNo": "2200630592", "ClientName": null, "CellNumber": "0787596971", "TenantName": null, "TenantCellNumber": null, "AddressStandNo": null, "AddressStreet": "43 DELMAS AVENUE", "AddressSuburb": "BOKSBURG", "AddressCity": null, "AddressPortion": null, "AddressEarthNo": null, "AddressPremise": null, "AddressGISKEY": null, "AmountDueTotal": 4080.0, "AmountDue30Day": null, "AmountDueCurrent": null, "AmountDue60Day": null, "ServiceLevy": null, "MeterNumberWater": null, "MeterNumberElectricity": "M22541", "MeterNumberElectricity2": null, "MeterNumberElectricity3": null, "MeterNumberPrePaid": null, "IsPrinted": true, "IsResidential": null, "ActionSuccessful": false, "ActionCardDate": "2016-08-22T00:00:00", "Remarks": null, "UnSuccessfulReason": null, "CaptureContractorId": null, "AddressCombo": ", 43 DELMAS AVENUE, BOKSBURG, , ", "BillCycleName": "120", "ServiceIndicator": null, "WaterReading": null, "WaterReadingDate": null, "ElectricityReading": null, "ElectricityReadingDate": null, "Unit": null, "ActionCardTypeId": 2, "ContractorId": 1, "ActionCardStatusId": 1, "UnSuccessfulActionReasonId": null, "TechnicianId": 1, "AccountInfoId": null, "ServiceDeliveryCentreId": 4, "BillCycleId": 2, "ActionCardType": null, "Contractor": null, "ActionCardStatus": null, "UnSuccessfulActionReason": null, "Technician": null, "AccountInfo": null, "ServiceDeliveryCentre": null, "BillCycle": null, "ActionName": "ED", "DateCreated": "2016-07-06T00:00:00", "DateModified": "2016-08-13T10:51:16.575637", "CreatedByOnlineUserId": null, "ModifiedByOnlineUserId": "fa93e65d-e4a7-4a0c-91c6-4561e2612f9c", "CreatedByUser": null, "ModifiedByUser": null }, { "ActionCardId": 3, "ActionCardNumber": "279875", "AccountNo": "2200630306", "ClientName": null, "CellNumber": "0787596971", "TenantName": null, "TenantCellNumber": null, "AddressStandNo": null, "AddressStreet": "43 DELMAS AVENUE", "AddressSuburb": "BOKSBURG", "AddressCity": null, "AddressPortion": null, "AddressEarthNo": null, "AddressPremise": null, "AddressGISKEY": null, "AmountDueTotal": 4080.0, "AmountDue30Day": null, "AmountDueCurrent": null, "AmountDue60Day": null, "ServiceLevy": null, "MeterNumberWater": null, "MeterNumberElectricity": "M22541", "MeterNumberElectricity2": null, "MeterNumberElectricity3": null, "MeterNumberPrePaid": null, "IsPrinted": true, "IsResidential": null, "ActionSuccessful": true, "ActionCardDate": "2016-08-22T00:00:00", "Remarks": null, "UnSuccessfulReason": null, "CaptureContractorId": null, "AddressCombo": ", 43 DELMAS AVENUE, BOKSBURG, , ", "BillCycleName": "120", "ServiceIndicator": null, "WaterReading": null, "WaterReadingDate": null, "ElectricityReading": null, "ElectricityReadingDate": null, "Unit": null, "ActionCardTypeId": 2, "ContractorId": 1, "ActionCardStatusId": 1, "UnSuccessfulActionReasonId": null, "TechnicianId": 1, "AccountInfoId": null, "ServiceDeliveryCentreId": 4, "BillCycleId": 2, "ActionCardType": null, "Contractor": null, "ActionCardStatus": null, "UnSuccessfulActionReason": null, "Technician": null, "AccountInfo": null, "ServiceDeliveryCentre": null, "BillCycle": null, "ActionName": "ED", "DateCreated": "2016-07-06T00:00:00", "DateModified": "2016-08-13T10:51:16.6757162", "CreatedByOnlineUserId": null, "ModifiedByOnlineUserId": "fa93e65d-e4a7-4a0c-91c6-4561e2612f9c", "CreatedByUser": null, "ModifiedByUser": null }]
В чем тут может быть проблема?
Я использую jsonp, потому что я использую кросс-домен.
Спасибо.
Что я уже пробовал:
$("#importDailyJobs").click(function () { var technicianId = 1; var serverUrl = "http://localhost:35825/Mobile/ImportDailyReadings" $.get(serverUrl, { TechnicianId: technicianId }, function (data, status) { alert("Success"); console.log(data); }, "jsonp"); });