$.ajax({
type:"post"
url:"/text/funtext/1" ///這是默認路由 {controller}/{action}/{id}
success:function(data){
//回傳的數據
}
})
//對應方法獲取參數
【httppost】
public string funtext(string id)
{
//id就是1
}
-------------------------------------------------------------------------------
$.ajax({
type:"post"
url:"/text/funtext" ///這是mvc路由 {controller}/{action}
data:{'name':'這是測試'}
success:function(data){
//回傳的數據
}
})
//對應方法獲取參數
【httppost】
public string funtext(string name)
{
//name就是 “這是測試”
}
//或者
【httppost】
public string funtext()
{
//Request.From可以獲取頁面傳遞的所有參數
//Request["name"].ToString();
}
//當然還有其他方法 就不一一說