2012-02-08 59 views
1

我想現在ASP.net MVC同樣動作的兩個電話之間的區別:使用GET和POST由ASp.net MVC

public class VisualizzareAreaIntervento 
    { 
     public string Descrizione { get; set; } 
     public int PageNum { get; set; } 
     public int PageSize { get; set; } 
    } 

public JsonResult GetItems(VisualizzareAreaIntervento command){ 
... 
} 

如果我通過郵政稱呼它,一切工作正常而在行動aprameter命令以及初始化:

var command = new VisualizzareItems(descrizione,pageNum,pageSize); 
     $.ajax({ 
      type: 'Post', 
      url: '@Url.Action("GetItems")', 
      data: JSON.stringify(command), 
      contentType: 'application/json; charset=utf-8', 
      success: success, 
      error: error, 
      dataType: 'json' 
     }); 

與得到相同的電話,讓我在它與默認值的命令對象(「」,0,0)

var command = new VisualizzareItems(descrizione,pageNum,pageSize); 
      $.ajax({ 
       type: 'Get', 
       url: '@Url.Action("GetItems")', 
       data: JSON.stringify(command), 
       contentType: 'application/json; charset=utf-8', 
       success: success, 
       error: error, 
       dataType: 'json' 
      }); 

我已經看過螢火蟲,並且對象發送了兩次。 ASP.net MVC如何解決這個問題?

感謝您的支持,

回答