Answer the question
In order to leave comments, you need to log in
Why is the Unexpected end of input error displayed?
There is a code
var request = new XMLHttpRequest();
request.open("GET", "/Home/Test", true);
request.onprogress = function () {
var pol = request.responseText;
var k = JSON.parse(pol);
}
request.send(null);
var k = JSON.parse(pol);
public JsonResult Test()
{
return Json(new { name = "Вова", secondName = "Иванов" },JsonRequestBehavior.AllowGet);
}
request.readyState === 4
Answer the question
In order to leave comments, you need to log in
I will turn on the telepathy module and assume that the script that gives the answer is a php script. In this case, it is probably saved with utf8 encoding with BOM, or the output contains extra line breaks.
The solution is to resave the file in utf8 without BOM or exclude line breaks, respectively.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question