嗨,我是JSON新手,我正在用我发现用PHP和jQuery编写的一个例子(http://wil-linssen.com/entry/extending-the- jquery的可排序与 - Ajax的MySQL的/)。对C#方法的jQuery/JSON/PHP对象
我想要做的是采取序列化的“订单”对象,并在C#方法中使用它,就像它在上面的示例中使用PHP一样。
所以jQuery代码是:
<script type="text/javascript">
// When the document is ready set up our sortable with it's inherant function(s)
$(document).ready(function() {
$("#test-list").sortable({
handle : '.handle',
update : function() {
var order = $('#test-list').sortable('serialize');
$("#info").load("process-sortable.php?"+order);
}
});
});
</script>
,而不是通过“订单”对象的处理程序在PHP中进行处理,如:
<?php
/* This is where you would inject your sql into the database
but we're just going to format it and send it back
*/
foreach ($_GET['listItem'] as $position => $item) :
$sql[] = "UPDATE `table` SET `position` = $position WHERE `id` = $item";
endforeach;
print_r ($sql);
?>
我想这样做完全一样的但是使用C#4.0来处理同一页面中的方法中的对象。这是可能的,有人可以告诉我如何做到这一点?
编辑: 我使用ASP.NET Web窗体& C#4
非常感谢!
这取决于你使用的是什么版本的ASP.NET? WebForms或MVC? – mccow002 2012-03-27 22:38:45
我正在使用ASP.NET WebForms – Jared 2012-03-27 22:45:37