call a page by passing parameters in the url

Asked

Viewed 241 times

1

I have a simple HTML file that is accessed by:

https:111.111.111:8080/index.html/?login="me"&password="1234"

The problem is that when trying to access it gives page non-existent. I put a page teste.html there, with pure HTML and Acessei with https:111.111.111:8080/teste.html and accessed normal, I believe it may be some problem with the parameters. Someone can help me?

Follow the code of my page below:

<html>
<head>
    <title>Teste</title>
    <meta charset="UTF-8">
</head>
<body onload="myFunction()">

    <div id="log"></div>
    <div id="pass"></div>

    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script type='text/javascript'>

        function myFunction() {

            var parameters = location.search.substring(1).split("&");

            var temp = parameters[0].split("=");
            l = unescape(temp[1]);
            temp = parameters[1].split("=");
            p = unescape(temp[1]);
            document.getElementById("log").innerHTML = l;
            document.getElementById("pass").innerHTML = p;
        }

    </script>

</body>

  • Try it like this: https:111.111.111:8080/index.html?login=me&password=1234

1 answer

1


The problem is in the quotation marks of the url:

https:111.111.111:8080/index.html?login=me&password=1234

I think it solves.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.