问题 2012-02-11 16:16:35 点击:20973
刚刚接触JQuery 和easyui,东西是好东西,可是怎么才能前后互动呢?
用的是asp.net mvc开发模式,前台用的JQuery easyui。
网上的资料实在是少的可怜,大多是java的
我现在不明白的是如何实现简单的增删改?EasyUI DataGrid如何和后台交互呢?怎么才能向后台传输数据。最好有个案例项目。
不管是原创还是copy(如果能copy的话。。。)都给加分。
目前我只知道easyui DateGrid可以读取json的数据,可是asp.net怎么转成JSON就不懂了
推荐答案 2012-02-11 16:16:35
JQuery 与后台交付有get和post两种方法,我这里给你简介绍一下吧:
get方法:$.get("index.ashx?userName=123",function(data){
//index.ashx后台地址 userName参数 123参数值
//data是从后台返回来的数据
});
post方法:
$.post("index.ashx",{userName:"你好"},function(data){
// //index.ashx后台地址 userName参数 123参数值
//data是从后台返回来的数据
});
index.ashx:
<%@ WebHandler Language="C#" Class="index" %>
using System;
using System.Web;
using SQLLibary;
using System.Data;
using System.Text;
public class index : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string type = context.Request["userName"];
context.Response.Write(type);
}
}
public bool IsReusable {
get {
return false;
}
}
}
有什么不懂可以追问!有空就帮你解答!
- 1楼 学PHPER说: 2013-07-03 23:18:11
-
你知道时间是怎么显示的吗?