Monday, May 13, 2024
41
rated 0 times [  46] [ 5]  / answers: 1 / hits: 15312  / 13 Years ago, mon, july 11, 2011, 12:00:00

I need a very detailed ebook/tutorial/video in very simple language for jquery AJAX and JSON with asp.net MVC3 . I have been googling but could't find any good one. Please send me links.



Thanks.


More From » asp.net-mvc-3

 Answers
72

From a client side use $.ajax:



$.ajax({
type: POST,
url: users/save,
data: name=John&location=Boston,
success: function(msg){
alert( Data Saved: + msg );
}


From a server side handle ajax requests:



public ActionResult Save(string name, string location)
{
//Save data

return new JsonResult(){Data = User was saved!};
}


Use JsonResult to return json string to the client and JSON.parse to parse json string at the client side.



To simplify ajax calls you can also create wrappers around $.ajax and JsonResult, define your ajax requests structure like {data:jsonString, messagess: [], redirect_url } etc.



That's all tutorial.


[#91243] Sunday, July 10, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
clarkulisesa

Total Points: 422
Total Questions: 93
Total Answers: 112

Location: Austria
Member since Thu, Jan 7, 2021
3 Years ago
clarkulisesa questions
Mon, Feb 24, 20, 00:00, 4 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;