<?php
error_reporting(false);

header('Content-Type: application/json');
header("Cache-Control: no-cache");
header("Pragma: no-cache");

include('conexao.php');

$array=json_decode($_POST['jsondata']);

$erro = 0;

foreach($array as $ordem => $id) {
 if($up = mysqli_query($con, "update slides set ordem = ".$ordem." where id = ".$id)) { } else {$erro = 1;}
}

if($erro == 0) {
$varm = array('resp' => 'ok');
} else {
$varm = array('resp' => 'erro');
}

echo json_encode($varm); 

?>