当我在jqGrid中编辑数据时,我使用PHP页面来更新数据(使用参数"editurl")。
$("#campionati").jqGrid({
url: "dbread.php",
datatype: "json",
mtype: "GET",
colNames: ["ID", "Nome", "Descrizione", "URL"],
colModel: [
{name: "id", width: 16, align: 'center'},
{name: "nome", width: 90, align: 'right', editable: true},
{name: "descrizione", width: 80, editable: true},
{name: "url", width: 600, editable: true, formatter: 'link', formatoptions: {target: '_blank'}}
],
editurl: "dbwrite.php?action=updateCampionati",
pager: "#pager",
...
。
我的问题是:什么类型的数据,我的PHP页面必须返回告诉jqGrid,如果更新已经成功或不?
<php
...
echo 0;
或
<php
...
echo json_encode(array("result" => "OK"));
服务器响应的HTTP状态码很重要。您的代码似乎返回状态码200 OK。因此,回应将被解读为成功。要返回有关错误的信息,可以使用http_response_code,例如: