Tuesday, 15 March 2011

asp.net mvc 3 - how to get the result from controller in ajax json -



asp.net mvc 3 - how to get the result from controller in ajax json -

isend aruguments controller using ajax not homecoming value.

my concept : selected @html.dropdownlist value send controller , using value thats perfrom valus bind property dropdownlist using mvc3

igot reply : verfif given link

verfif given link

you passing type alternative in ajax twice , url not formatted properly

function onchange(bookid) { $.ajax({ type: "get", url: '@url.action("books","subject")', info : { bookid: bookid}, datatype: "json", success: function (result) { alert('success'); //do whatever want }, error: function(result){ } }); };

you passing datatype json. so, if want nail success result $.ajax, need return json action result instead of returning view.

when homecoming view gives error always.

public actionresult books(string bookid) { var books= service.books(projectid); // books stored in list format homecoming json(books); }

hope helps you.

asp.net-mvc-3 jquery http-post

No comments:

Post a Comment