How to load highscores in javascript

I’ve searched around, and everything I’ve found says to yield the stream so unity automatically waits for it to load, however whenever I try it, either locally in-editor or on my server, it doesn’t do anything.

function LoadScores()
{
    var postData:WWWForm = new WWWForm();
    // add post variables
    
    var webData:WWW = new WWW(url, postData);
    
    yield webData;
    
    // parse the returned data from webData.text
}

Unify Wiki

Also, my understanding of the yield keyword means that the function would need to be called repeatedly untill the scores are loaded, as the function starts from the following line the next time it’s called. Is this correct?

Thanks in advance.

EDIT:

Just tried this, but still not working.

function LoadScores()
{
    var postData:WWWForm = new WWWForm();
    // add post variables
    
    var webData:WWW = new WWW(url, postData);

    while (!webData.isDone)
    {
        yield webData;
    }
    
    // parse the returned data from webData.text
}

You need to call the method asynchronically.

//Add the IEnumerator return type.

function LoadScores():IEnumerator
{
    var postData:WWWForm = new WWWForm();
    // add post variables

    var webData:WWW = new WWW(url, postData);

    yield webData;

    // parse the returned data from webData.text
}

//Call the method using StartCoroutine

StartCoroutine(LoadScores());