Concatenate Server Side Code in Jquery
$("#Selection").change(function () {
var text = $("#Selection option:selected").text();
alert(text);
var valueSelected= this.value;
alert(valueOfLanguag开发者_StackOverflow社区e);
var url = 'OpenServerQuote Html.SelectorLink("' + valueSelected+ '", "[' + text + ']", "' + text + '", null) CloseServerQuote';
var hrefValue = $(url).attr("href");
alert(hrefValue);
});
I need to pass the value and text of dropdown to a HTML helper method and get the the result. But when I pass the value to html helper as shown above, instead of values valueselected string is passed. Any pointers how to proceed on this.
*OpenServerQuote = <%
CloseServerQuote = %>
One of us is mighty confused here... You are trying to execute server side code with client side parameter? It does not work that way...
You either need to execute Ajax request with the parameter and then run the code on the server side or have server side code output a template string and then substitute your valueSelected
client-side.
精彩评论