asp.net MVC3 and jquery AJAX tutorial [closed]

2020-02-29 01:17发布

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.

5条回答
爷的心禁止访问
3楼-- · 2020-02-29 01:35

Eric Sowell was mentioned above.

The link to his talk is:

Evolving Practices in Using jQuery and Ajax in ASP.NET MVC Applications

You need to understand JavaScript prototypes to understand, or rather, be able to use the recommended practice.

But it is well worth it. You end up with a VERY reusable pattern for ALL the javascript in your apps, not just the AJAX bits.

Plus you have something to bang your head against until you really understand JavaScript, as opposed to Cookbook recipes for jQuery.

Ie, if you don't structure your jQuery/JS in some way, you will end up with a bowl of spaghetti.

Other books: David Crockford wrote a short book: Javascript, the Good Parts. This explains prototypes and a lot else, very concisely. There is also a GREAT article in MSDN Magazine, May 2007 by Ray Djajadinata:

JavaScript: Create Advanced Web Applications with Object-Oriented Techniques

If you read that article ten times, you will understand JavaScript.

查看更多
孤傲高冷的网名
4楼-- · 2020-02-29 01:35

Did you try the official Microsoft resources?

查看更多
做自己的国王
5楼-- · 2020-02-29 01:46

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.

查看更多
女痞
6楼-- · 2020-02-29 01:49

You could try one of the sessions from the MVCConf presented by Eric Sowell (@Mallioch). It is a good tutorial and so are quite a number.

查看更多
登录 后发表回答