2013-12-09 54 views
1
var UserStore = Ext.create('Ext.data.JsonStore', { 
    model: 'VehicleModel', 
    autoLoad: true, 
    proxy: { 
     type: 'ajax', 
     url: 'get-vehicle.php', 
     api: { 
       create: 'insert-vehicle.php', 
       //read: 'http://visual04/ModuleGestion/php/Pays.php?action=read', 
       update: 'update-vehicle.php', 
       //destroy: 'http://visual04/ModuleGestion/php/Pays.php?action=destroy' 
        success: function(action){ 
          Ext.MessageBox.show({ 
          title: 'Information', 
          msg: action.result.message, 
          buttons: Ext.Msg.OK, 
          icon: Ext.MessageBox.INFO 
         }); 
        }, 
        failure: function(action){ 
          Ext.MessageBox.show({ 
          title: 'Error', 
          msg: action.result.message, 
          buttons: Ext.Msg.OK, 
          icon: Ext.MessageBox.ERROR 
         }); 
        } 
      }, 

     reader: { 
      type: 'json', 
      idProperty: '_id' 
     }, 
     writer: { 
      type: 'json', 
      id: '_id' 

     } 
    } 
}); 

這是php更新成功返回存儲更新API效應初探成功和失敗

<?php 
$data = file_get_contents("php://input"); 
//echo $data; 
//$obj = var_dump(json_decode($data)); 

$obj = json_decode($data); 
$_id = $obj->{'_id'}; 
$Plat_No = $obj->{'Plat_No'}; 

mysql_connect("localhost", "root", "Apacheah64") or die("Could not connect"); 
mysql_select_db("db_shuttlebus") or die("Could not select database"); 

$query = "UPDATE tbl_vehicle SET Plat_No ='". $Plat_No ."' WHERE _id=".$_id; 

if (mysql_query($query)){ 
    echo '{"success":true,"message":"Update Success !"}'; 
}else{ 
    echo '{"success":false,"message":"Update Failed !"}'; 
} 

?> 

這是Firebug的顯示成功,但爲什麼仍無法彈出消息框? enter image description here

回答