Tengo un problema al usar ajax,
Tengo un controlador que me da un objeto simple (en mi caso es solo un nombre) pero tengo este error ( SyntaxError: Unexpected end of JSON input ) y no sé por qué.
Este es el código:
$(function a() { var $hello = $('#hello'); //Here #hello is a id which is inside a div $.ajax({ url: uri_3, type: 'GET', dataType: 'json', // if i put text here also don't work, gives sucess but don't appear the //name success: function (data) { //have a problem get the name , also I try just $hello.append //alone and using h2 rather than li but don't work $.each(data, function c(i, name) { $hello.append('<li>Name: ' + name + '</li>'); }); }, error: function (xhr, textStatus, errorThrown) { //it always gives me this error, it //doesn't reach the top success console.log('Error in Operation'); $hello.append('<h4> User Not Found: ' + errorThrown + '</h4>'); } }); });Dado que la función de backend está funcionando (la probé usando swagger y me da el nombre correcto), asumo que el error debe estar en esta función ajax. ¿Qué más tengo que agregar?
cualquier respuesta es bienvenida