JSON problem on Supervideo.tv remote upload app

Discussion in 'Javascript' started by hacxx, Jun 20, 2020.

  1. hacxx

    hacxx

    Joined:
    Feb 19, 2020
    Messages:
    21
    Likes Received:
    0
    Hi,

    I developed this app to remote upload videos to Supervideo.tv but i'm having problems with uploads. I'm getting CORS issues. Can anyone view the source and tell me what's the issue?

    Code (Text):

    <html>
    <title>Supervideo.tv Remote Upload APP</title>
    <center>
    <p>File Location : <input type="text" id="filelocation"> <input type="submit" name="submit" value="Upload!" onclick="start()"><br><br><font size="-2">A APP to remote upload videos to Supervideo.tv</font></p>
    </center>
    <script>
    function start(){
    var filelocation = escape(document.getElementById('filelocation').value);
    if (filelocation == "") {alert('Type a video link'); return false;}
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
    var myObj = JSON.parse(this.responseText);
    document.write('<center><br><br>https://supervideo.tv/'+ myObj.result.filecode +'</center>');
    }
    };
    xmlhttp.open("GET", "https://supervideo.tv/api/upload/url?key=1149wr982foddk898vzx&url="+filelocation+"&adult=0", true);
    xmlhttp.send();
    }
    </script>
     
    Thanks
     
    hacxx, Jun 20, 2020
    #1
    1. Advertisements

  2. hacxx

    sunfighter

    Joined:
    Nov 27, 2019
    Messages:
    108
    Likes Received:
    14
    Quick reply:
    The escape() function was deprecated in JavaScript version 1.5. Use encodeURI() or encodeURIComponent() instead.
    AND
    document.write() destroys the HTML you have on the browser. use
    document.getElementById("demo").innerHTML and make that element in the HTML.
     
    sunfighter, Jun 20, 2020
    #2
    1. Advertisements

  3. hacxx

    hacxx

    Joined:
    Feb 19, 2020
    Messages:
    21
    Likes Received:
    0
    I will use that, what about the problem?
     
    hacxx, Jun 20, 2020
    #3
  4. hacxx

    sunfighter

    Joined:
    Nov 27, 2019
    Messages:
    108
    Likes Received:
    14
    CORS issues => but no message. CORS always gives a messages as to why things didn't work.
    OK, I says, I'll just try this myself. SO went to https://supervideo.tv/ and then tried to set up account and got this:
    This might be the reason for failure. No way I could know.
    CORS by the way comes from your browser and it highly possible that the site does not support or supports improperly the CORS requests. Check with the site.

    What you need to do in the mean time is see what headers you are sending and which are killing the process.

    ALERT: since this did not work for me at all, I think the problem lies with SuperVideo.
     
    sunfighter, Jun 20, 2020
    #4
  5. hacxx

    hacxx

    Joined:
    Feb 19, 2020
    Messages:
    21
    Likes Received:
    0
    ok, thanks.
     
    hacxx, Jun 20, 2020
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.