我正在尝试使用 jQuery $.ajax() 方法(如下面的 php 页面所示)更新 Google 融合表中的一行。如果我将 .$.ajax() 方法中的“类型”更改为 GET 并尝试 SELECT 语句,我会返回预期的数据,但是当我尝试使用 POST 的 UPDATE 语句时,什么也没有发生。查询语句基于以下文档。任何关于我做错了什么的建议将不胜感激。
<!DOCTYPE html>
<html>
<head>
<?php
//Include fusion table php libraries
include('Libs/clientlogin.php');
include('Libs/sql.php');
include('Libs/file.php');
$username=<MY USER NAME>;
$password=<MY PASSWORD>;
$token=ClientLogin::getAuthToken($username,$password);
$ftclient=new FTClientLogin($token);
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
<script>
var token = "<?= $token ?>";
function updateTable() {
var URL = "https://www.google.com/fusiontables/api/query/?sql=UPDATE <TABLEID> SET <COLUMN NAME> ='new value' WHERE ROWID =<SOME ROW ID>";
$.ajax({
type: "POST",
url: URL,
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
//name_startsWith: request.term
},
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "GoogleLogin auth=" + token);
},
success: function run(data) {},
});
}
</script>
<a href="" " data-role="button " onclick="updateTable(); return
false " rel="external ">Post</a>
</body>
</html>