You are viewing limited content. For full access, please sign in.

Question

Question

xmlHttp.send problems with LF App in Forms

asked on September 12, 2017

When using xmlHttp.send object in javascript inside of a form, the xmlHttp.responseText variable is always blank when accessing the form using the LF App. It works when using a web browser. Is this object only supported by web browsers.

 

function httpGet(theUrl)
{
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
    xmlHttp.send( null );
    return xmlHttp.responseText;
}
    
    //var week = $('.week input').val();
    var week = 1;
    var currentweek = httpGet('http://www.nfl.com/ajax/scorestrip?season=2017&seasonType=REG&week='+week);

 

0 0

Replies

replied on June 11, 2019

Chad,

I realize that this is an old post, but were you ever able to get this resolved? I am having the same issue within Forms.

0 0
replied on June 11, 2019

I am thinking it might be because they were using https in the connection through the app and they needed to use http.

You can not request non-secure data from another source when the client is requesting to use encryption. I think this is a bit silly, since you want to encrypt your login credentials, just not the data displayed on the screen.

I feel like there should be a feature to encrypt login pages only. If your API provider allows encryption, then it is no problem, but in my case these NFL schedules were public information and encryption was not allowed.

0 0
replied on June 11, 2019

Yeah...I thought that too, so I created two test html pages using only http. One was source.html and the other was just a test html page that used javascript to load the source.html. It worked fine. When I used the same javascript inside a form to load the same source.html page, it would not return the responseText.

0 0
replied on June 11, 2019

Ok, maybe it is just a problem with using the app. I don't know how to access the console when using the app so that the code can be debugged.

0 0
replied on June 12, 2019

I'm getting the same error in the console that a couple other people have documented, but haven't seen any resolution from LF...

Access to XMLHttpRequest at 'http://localhost/source.htm' from origin 'http://mcci-train-1' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Sounds like it is related to linking to a page that is has a different domain. Here is a good article on CORS in case you're interested.

https://www.html5rocks.com/en/tutorials/cors/

0 0
replied on June 12, 2019

Simple solution on my test page was to use the server name in my URL instead of localhost. That way, Forms was using the same base URL

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.