0
私はIdでプロダクトを取得するWebアプリケーションをWebアプリケーションで使用しています。私はこのオブジェクトの更新をJQueryを使用して作成しようとしています。だから、のparamaterとしてIDを送信した後、コントローラからのウェブAPIを消費した後、剃刀を使用してビューにオブジェクトを渡す:コード上JQueryのURL.Actionリンクにパラメータを送信します
function UpdateProduct(id) { jQuery.support.cors = true; window.location.href = "@Url.Action("Update", "Product", new {id})"; }
をコンパイルしない、新しい{ID}でエラーを示しています。 IDを送信し、ページを読み込んでいる間にupdate.cshtmlビューからapiを消費し、Product値をtxtBoxにロードして更新します。
public class Product
{
public int Id { set; get; }
public string Name { set; get; }
public int Quantity { set; get; }
}
これを実現するにはどうすればJQueryを使用できますか? Url.Action @