ASP.NET MVC Load page with AJAX -


i have situation:

a page accordion 2 tabs, 1 has list of paymentmethods, second has summary of order orderlines, amounts , totals (rendered partialview). selecting paymentmethod causes order totals recalculated, costs etc might apply.

what recommended way display new ordersummary after paymentmethod selected, using ajax?

doing ajax call , getting new amounts, orderlines, etc , setting these values using js seems inefficient me. ideal situation if make ajax call selected payement method , call return html can use replace old summary.

is bad render partialview html on server , return using json? best practice situation?

in action method return partialview([view name]).

then can jquery:

var req = $.ajax({   type:"get",//or "post" or whatever   url:"[action method url]"   }).success(function(responsedata){     $('targetelement').append($(responsedata));}); 

where 'targetelement' selector element want inject content.

you might want $('targetelement').html(''); first before appending response target element.

update

or, better yet, use .load rick's answer.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -