javascript - Need a good tutorial on asp.net MVC2 AJAX for a Rails programmer -


making own asp.net mvc2 web app first time. i've been using rails 3 years , consider myself pretty proficient framework. switching over, i've been reading pdfs , far impressed @ asp.net has offer. web app have ton of javascript in , i'm going use jquery. i've read nerddinner's pdfs on ajax still don't seem give me want. example, in rails, can make ajax call controller renders js partial, , in partial, able access different variables update view. what's asp.net equivalent of that? there tutorials can better me understand how asp.net handles ajax?

the js partial in rails nice. don't know there's equivalent in asp.net mvc. 1 thing serialize object json. in callback, can use properties of json object dynamically update html javascript. take approach. hope helps.

edit

here's example

// controller public actionresult mycontrivedendpoint() {     var response = new     {         foo = "bar",         bar = "baz"     };      return json(response, jsonrequestbehavior.allowget); }  // javascript $.get(myurl, mysuccessfunction);  function mysuccessfunction(response) {     $('#foo').html(response.foo);     $('#bar').html(response.bar); } 

edit

another option return normal aspx view. in case, response html , can drop div. aspx view contain script tags modify dom on $(document).ready()

always more 1 way skin cat!


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -