ASP.NET MVC & Ajax question

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top