Home > Mobile >  414 Request URI too long
414 Request URI too long

Time:09-21

    function makePage(content1){   
    var content =content1;
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function(){
        if(xmlhttp.readyState==4 && xmlhttp.status==200){
        alert("webpage "   xmlhttp.responseText   " was successfully created!");
        }
        else{
            console.log("hata");
        }
        }
        xmlhttp.open("POST","makePage.php?content=" content ,true);
        xmlhttp.send();
        }

I am getting error 414 because the data is written inside the url. How can I fix this?

CodePudding user response:

With POST requests, you put your content into the body of the request.

xmlhttp.open("POST","makePage.php" ,true);
xmlhttp.send(content);

CodePudding user response:

There is a limit to how much the length of the URL can be so sending large data would result in this error. As you are using post request why not send the data in body instead.

Anything you try will end up sending data in body.

  • Related