我在Slim Framework集成中使用phpgrid,我看到phpgrid系统的所有编辑和创建功能都将数据发送到位于phpgrid文件夹内的名为“edit.php”的文件。
有什么方法可以改变它并实际将表单的结果路由到另一个文件,最好是Slim中的控制器?
L.E:值得一提的是,我没有使用数据库连接来处理数据。相反,我使用API来获取和处理我的数据,并将数据提供给数组中的phpgrid。
答案 0 :(得分:1)
Google" phpgrid保存本地数组"发表这篇文章
Save Local Data Array Back to Server via Ajax
您可以使用jQuery ajax帖子中的更改提交到您选择的任何网址
<script src="http://malsup.github.com/jquery.form.js"></script>
<form id="admin_form">
<div>
<input type="submit" value="Submit Local Changes">
</div>
</form>
<script>
$(function() {
// bind to the form's submit event
$('#admin_form').submit(function(event) {
$(this).ajaxSubmit({
type: 'post',
dataType:'json',
url:'save_local_array.php',
data:{
langArray:[] //leave as empty array here
},
beforeSubmit: function(arr, $form, options){
options.langArray = $('#data1').jqGrid('getRowData'); //current
console.log(JSON.stringify(options.langArray));
// return false; // here to prevent submit
},
success: function(){
// add routine here when success
}
});
// return false to prevent normal browser submit and page navigation
return false;
});
});
</script>
答案 1 :(得分:0)