I got this mvc core application. One of its methods looks like this(for now)
public IActionResult Call(string call)
{
Response.ContentType = "text/plain";
return Ok (call);
}
and a javascript in browser looks like that
var xhttp = new XMLHttpRequest();
xhttp.withCredentials = true;
xhttp.open("GET", request, true);
xhttp.onreadystatechange = function ()
{
if (this.readyState == 4)
{
if (this.status == 200)
{
SetAnswerText(this.responseText);
}
else
{
SetApiCallTextAreaValue("request - \n" + request + "\n failed; status = " + this.status);
}
}
else
{
SetApiCallTextAreaValue("current status is " + this.readyState + "\n" + this.responseText);
}
}
for some reason, I get only notification with readystate==3(LOADING), and never.. with readystate==4(DONE) which im expecting.
Can you help me figuring it out why thats happaning?
btw, if I open an url to this Call method in browser like https://..../Call/?call=123 it works absoulutely fine..
omg ..忘记将功能名称从SetAnswerText更改为SetApiCallTextAreaValue ..必须多睡一会..仅当我在浏览器中查看代码时才发现错误:P
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.