c# - How to call Html.RenderAction() with parameters declarated in jscript? -


i have javascript in *.cshtml file

$(function () {  sliderdiv.slider({   range: true,   min: minval,   max: maxval,   values: [minval, maxval] });  sliderdiv.bind("slidechange", function (event, ui) {    var d = "min=" + ui.values[0] + "&max=" + ui.values[1];   $.ajax({     type: "post",     url: '@url.action("update", "default")',     data: d,     success: function (result, ajaxobj) {         alert('ok');         alert(result.min + " - " + result.max);         $("#ajaxresult").html('@{html.renderaction("update", "default");}');     },    error: function (ajaxobj, message, exceptionobj) { alert('no'); } }); }); } 

and controller:

public actionresult update(int? min, int? max)         {             if(min == null) min = 1;             if(max == null) max = 1;             var s = new slidermodel()                                 {                                     min = (int)min * 1000,                                     max = (int)max * 1000                                 };              return new jsonresult                        {                            data = s,                            contentencoding = encoding.utf8,                            jsonrequestbehavior = jsonrequestbehavior.allowget,                            contenttype = "json"                        };          } 

i want use line

$("#ajaxresult").html('@{html.renderaction("update", "default");}'); 

to send ui.values[0] , ui.values[1] min , max parameters html.renderaction("update", "default")

something $("#ajaxresult").html('@{html.renderaction("update", "default", new {min = ui.values[0], max = ui.values[1]});}');

how can that???

var url = '@url.action("update", "default")'; url += '/?min=' + ui.values[0] + '&max=' + ui.values[1]; $("#ajaxresult").load(url); 

load docs:

description: load data server , place returned html matched element.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -