0

I'm getting a 403 error while making an AJAX request to a php page of my own website.

This is the error:

"jq.js:663 POST https://playonlineloto.com/backend/cstatus.php 403"

I'm using jQuery to make the request. The code is:

function status() {
            var table = document.getElementById("table").value;
            var name=document.getElementById("username").innerHTML;
            var card=document.getElementById("card").innerHTML;
                var dataString = "table=" + table+"&name="+name+"&card="+card;
            $.ajax({
                    type: "POST",
                    url: "cstatus.php",
                    data: dataString,
                     
                    cache: false,
                    success: function(html) {
                       
                       if(html=="no"){
                           
                       }else{
                         console.log("kicked out");  
                         console.log(html);
                          var kick = document.getElementById("kick");
                          kick.style.display="block";
                       } 
                    }
                });
        };

and I'm requesting from this url

https://playonlineloto.com/backend/custom-game.php?val=1&table=U7Gh8c7f6&admin=yes

My files have enough permission. Please help me!!

ADyson
  • 57,178
  • 14
  • 51
  • 63
  • You have to decide what data you need to send – Serge Feb 25 '22 at 16:08
  • `My files have enough permission`...your server disagrees with you. Since it's a computer it cannot lie, or misread the permissions settings. So who do you think is going to be correct - you, or the computer? I suggest disregarding any assumptions you may have made, and checking everything again. – ADyson Feb 25 '22 at 16:39
  • Alternatively, it's possible that the 403 is caused by some webserver setting (e.g. the URL requires a password) or that the PHP code being executed generates that response code for some reason. We of course cannot tell, because you shared nothing about the server or the code. Please provide a [mre] of the issue, if you need help here. Otherwise we can't do any more than the speculation I've already provided, and that's generally unproductive beyond a quick comment. – ADyson Feb 25 '22 at 16:40
  • Maybe duplicate from here? https://stackoverflow.com/questions/36666256/jquery-ajax-call-results-in-error-status-403 – Marco Feb 25 '22 at 16:47
  • 1
    @Marco This is not a CORS request, as shown by the URLs quoted by the OP. So it's unlikely to be relevant. – ADyson Feb 25 '22 at 16:48
  • I can't understand what you said @ADyson – Sudhanshu Singh Feb 26 '22 at 07:45
  • I said quite a lot. Which bit is confusing you? – ADyson Feb 26 '22 at 08:58
  • this "This is not a CORS request, as shown by the URLs quoted by the OP. So it's unlikely to be relevant." – Sudhanshu Singh Feb 26 '22 at 09:13
  • It was in response to the comment made by Marco, saying that the link they posted would not be helpful for your issue. Unless you've read that link, my comment wouldn't make sense. But it was aimed at Marco, not you, which you can see by the @ at the beginning – ADyson Feb 26 '22 at 21:48
  • @cyberbrain again, this isn't relevant. See my comment to Marco above. Not the same situation. – ADyson Feb 27 '22 at 21:34
  • 1
    Ok, I try for something more relevant then, @ADyson ;-) - OP: does your server need any authentication? HTTP status 403 usually states that you are authenticated (e.g. with username and password), but this authentication does not give you permission to access what you want on the server. – cyberbrain Feb 27 '22 at 21:39

0 Answers0