-1

I'm trying to fetch data from a website; however, it return a PHP file as text without the result that I look for (the result after enter all required input) after sending out all the information by using 'POST' method to the server

Down here is my code that I used to fetch info:

var form = {
    'cp': poke_cp,
    'p_id': poke_id,
    'hp': poke_hp,
    'dust': poke_dust,
    'up': "1"
};
$.ajax({
    type: 'POST',
    url: "https://pokefind.co/ivcalc.php",
    dataType: "text",
    data: form,
    success: function (data) {
        console.log(data);      
    }
});
Ashish Ahuja
  • 4,913
  • 10
  • 51
  • 65

1 Answers1

0

As said in comments by @icecub, if the remote server does not allow cross origin requests you will not be able to fetch datas from the website.

The page you are trying to POST seems be the page that handle a form. So you have two problems :

  • CSRF, during the form handle there is a verification to be sure that you come from the form page
  • Cross Origin possibly not allowed.

If the website has a WebService you should use it.

Community
  • 1
  • 1
AnthonyB
  • 1,932
  • 1
  • 20
  • 28