So I have my PHP code here:
$r = new HttpRequest('https://api.worldoftanks.com/wot/auth/login/', HttpRequest::METH_POST);
$r->addPostFields(array('application_id' => 'e991ff783ae65f1ceefd1036211e5772', 'redirect_uri' => 'http://www.wotclanbuilder.com', 'nofollow' => 1));
try{
$result = $r->send()->getBody();
$json = json_decode($result);
$url = json_encode($json->data->location);
echo $url;
}
catch (HttpException $ex) {
echo $ex;
}
and my Ajax code here:
// AJAX Code To Submit Form.
$.ajax({
type: "POST",
url: "functions/signup-sql.php",
data: dataString,
cache: false,
success: function(result){
console.log(result);
}
When I run the PHP code by itself it echos this:
"https:\/\/na.wargaming.net\/id\/openid\/?openid.assoc_handle=%7BHMAC-SHA1%7D%7B566a9b22%7D%7BqJXljw%3D%3D%7D&openid.ax.if_availab.... blah blah blah basically just one big long url.
But when I run the ajax code it logs all the code in my index.php instead of that long url. The code that makes up the index page I should say. I'm just not understanding why. Any help is appreciated :)