Reputation: 218
I am having a problem with an extremely simple $.get() request. When I tested it with the error handling functions, it triggered the Error and Complete functions. Also, if I run the php file straight from my URL bar in my browser it works perfectly. Here is my code:
Inline JS: [located in root]
$.get('php/getRank.php', function(teamRank) {
alert("Your team has finished with rank: " + teamRank);
});
PHP: [located in root/php]
require_once '../includes/constants.php';
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD);
if(!$con){
die('Could not connect: ' . mysql_error());
}
mysql_select_db(DB_NAME, $con);
session_start();
*/ CALCULATE RANK HERE */
echo $rank;
Are there some PHP limitations or something when using $.get()? All I wanted to do is execute a PHP script from JS. Should I use something other than $.get()?
Thank you!
Upvotes: 0
Views: 90