Это мой JQuery ...
$.ajax({
type: 'POST',
url: 'http://adamscarter.co.uk/daily/facebook/savefbprofile.php',
data: {'fb_id': fb_id, 'fbusername': fbusername, 'location_id': location_id, 'gender': gender},
beforeSend: function() {
console.log('Before send: ' + fb_id, fbusername, location_id, gender);
},
success: function(data) {
console.log('saveFbProfile post ajax success');
console.log(data);
}
});
... а это мой PHP ...
<?php
session_start();
include('dbcon.php');
$gender = substr($_POST['gender'], 0, 1);
$fb_id = $_POST['fb_id'];
$location_id = $_POST['location_id'];
$fbusername = $_POST['fbusername'];
//Set session vars
$_SESSION['gender'] = $gender;
$_SESSION['fb_id'] = $fb_id;
$_SESSION['location_id'] = $location_id;
$_SESSION['fbusername'] = $fbusername;
if (isset($_SESSION['userid'])) {
mysql_select_db('users', $GLOBALS['conInsert']);
$sql = "UPDATE user_fb_details SET gender = '". $gender. "', fb_id = '". $fb_id. "', location_id = '". $location_id. "', username = '". $fbusername. "' WHERE user_id = '". $_SESSION['userid']. "'";
mysql_query($sql, $GLOBALS['conInsert']);
}
?>
Есть ли ошибка в моем коде? Когда я регистрирую переменные, все они имеют правильное значение, но я просто получаю 'parseerror'.