ASP.NET MVC & Ajax question

  • Thread starter Thread starter p3ktiff
  • Start date Start date
P

p3ktiff

Hi All,

I've have been searching the net for almost a week but i can't find what
im looking for.
I need help on my particular problem.

I have a model that is inherited by a viewpage.
ex.
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<myproject.person>" %>

In my view,I have a html form & fieldset which is mapped to the model,
base on the id's of html control's

My problem is, i used jquery when the submit button is clicked and i
don't know how to pass the model data in my controller's action method
parameter in java script

function postUpdate() {
var feedsPanel = $("#feedsPanel");

var name = $("#name").val();
var address = $("#address").val();

$.post("/Home/Index", { !!! i dont know what to put here
!!!! }, function(data) { feedsPanel.html(data); });
});

in my home controller

public actionresult Index(Person obj) {
.................
}


Please if someone has a solution for this..

thanks
 
post does a form post. the data should be name value pairs. in you case
something like:

{name: name, address: address}

but a json webservice would make more sense then a controler.


-- bruce (sqlwork.com)
 
Back
Top